Performance issue PDF to PNG

Hi,
We are using Aspose PDF Java (aspose-pdf-22.3.jar) to convert a pdf page to a BufferedImage.
Unfortunately this transformation is slow as it takes 1200ms - 1500ms per page.
In comparison PDFBox needs 360ms - 420ms for the same task which is 4 to 5 times faster.

Is there a more efficient way of doing this transformation?

Here is some example code with the aspose and pdfbox variant. The example pdf is attached.

File file = new File(dataDir, "sample.pdf");

// Aspose
Page page = (new Document(file.getAbsolutePath())).getPages().get_Item(1);
PngDevice pngDevice = new PngDevice(new Resolution(300));
long aspStart = System.currentTimeMillis();
BufferedImage asBufferedImage = pngDevice.processToBufferedImage(page);
System.out.println("Aspose: " + (System.currentTimeMillis() - aspStart));

// PDFBox
PDPage pdPage = PDDocument.load(file).getPage(1);
long pdStart = System.currentTimeMillis();
BufferedImage pdBufferedImage = pdPage.convertToImage(BufferedImage.TYPE_INT_RGB, 300);
System.out.println("PDFBox: " + (System.currentTimeMillis() - pdStart));

@martin.duerig,

The code you are using is the right way to do it. I will ask the dev team if there is a way to improve performance.

@martin.duerig
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): PDFNET-54501

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.

Shouldn’t the ticket be like PDFJAVA-12345 since we are using Aspose PDF Java (aspose-pdf-22.3.jar)?

@martin.duerig,

Thanks for replying. I will explain how the tickets work.

The Java version is created via an automatic process from the .Net version. So when an issue is found, we first test it on the .Net version. If the issue is there, then we create a ticket on .Net so that when the conversion is done, the fix will be propagated automatically to the Java release.

If the issue only happens on Java, then we create a Java ticket, which is handled differently.

I cannot give you too many details as I am not part of the dev team, but hopefully, this will give you a general idea of how it works and why it is a .Net ticket instead of just a Java ticket. Since the

In the ticket notes, I also noted that you are using Java specifically. But the speed seems to be the same on .net and java. So it worth looking at both.

1 Like

I understand that paid support has priority but do you have any updates regarding PDFNET-54501? Any analysis results or roadmap?

@martin.duerig

We are afraid that the earlier logged ticket has not been yet resolved. We will surely let you know as soon as we make some progress towards issue resolution or have any news about fix ETA. Please spare us some time.

We are sorry for the inconvenience.

1 Like