Aspose.pdf API fails to convert and save pdf to PPT

Hi,
Would you kindly advise why the below test is failing on Linux machines? It has been verified to be working fine on Windows and MacOs.

We are using aspose.pdf 24.8 version
Linux OS: Linux 1a82161ddb7d 6.4.16-linuxkit #1 SMP PREEMPT Tue Oct 10 20:38:06 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

You can find the file which is failing in the attachments.
P.S. failing_pdf_file.pdf has been generated by aspose.words exposed API and saved as PDF.

  @Test
  void export_specificISToPPT() throws Exception {
    try (InputStream inputStream = Objects.requireNonNull(Files.newInputStream(Paths.get(
        "failing_pdf_file.pdf")))) {
      byte[] pdf = inputStream.readAllBytes();
      try (Document srcDoc = new Document(pdf)) {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        srcDoc.save(outputStream, new PptxSaveOptions());
        byte[] result = outputStream.toByteArray();
        ISlideText[] slidesText = PresentationFactory.getInstance()
            .getPresentationText(new ByteArrayInputStream(result), TextExtractionArrangingMode.Unarranged)
            .getSlidesText();
        assertThat(slidesText.length).isGreaterThan(0);
      }
    }
  }

Error message:

PptxExporterTest > export_specificISToPPT() FAILED
    class com.aspose.pdf.internal.ms.System.lh: Invalid parameter used.

failing_pdf_file.pdf (13.9 KB)

@ANDREA.FARRIS
On Linux the problem may be caused by graphic processing
In this case we usually recommend using Aspose Pdf Drawing version as it’s more Linux oriented
Could you check if problem is reproduced with Aspose Pdf Drawing 24.8?

Hi @ilyazhuykov, for this particular case, pdf does not have any graphics inside. If you check it, it has only single line of text. As mentioned in the description of the issue, it was generated using aspose.words API. Please clarify if we should try using aspose-drawing api for saving pdf to ppt or in other part of the flow? If possible, code snippet as an example would be highly appreciated.

@ANDREA.FARRIS
I checked conversion, it seems that Aspose Pdf Drawing 24.8 resolves the issue
Basically you should try to use Aspose Pdf drawing instead of regular Aspose Pdf specifically on linux for PDF to PPTX conversion, you have no need to change your code
As for why there’s issues with graphic component I can’t give any clear anwser but in my case the error I recieve is specific for gzip graphic component which usually signals that Drawing version should be used
Here I attach the result I got after changing to Drawing version
failing_pdf_file_out.zip (9.3 KB)

Thank you @ilyazhuykov for the response.

Could you please share the code or configuration for using Aspose Pdf Drawing to convert from PDF to PPTX?

I can’t find the aspose-pdf-drawing library for Java. There does exist a com.aspose.pdf.drawing package in the aspose-pdf library but it only contains lower-level classes: com.aspose.pdf.drawing | Aspose.PDF for Java API Reference

@ANDREA.FARRIS
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFJAVA-44305

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Sorry for misinformation, I was sure that there was version for Java that could work the same way it works for .NET
I passed information to development team , hopefully it will be resolved soon

@ilyazhuykov , we have performed another quick test to identify the exact version of aspose.pdf when this issue started occurring. Not sure whether it helps, but it started breaking from 23.8 version upwards.

1 Like

@ANDREA.FARRIS
Thank you for information, I’ll add it to task

HI @ilyazhuykov. Do we have any update on PDFJAVA-44305?

@ANDREA.FARRIS
Unfortunately no, currently there’s no updates