We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting PDF to JPEG doesn't render background image

Hello the support team @ Aspose.

I am attempting to convert a PDF document into JPEG images using the JpegDevice.
I am using the AsposePDF .NET library (v17.9.0) in a 4.6.1 .NET framework project.

I can notice that some images are not rendered in the JPEG files but replaced with a cyan background instead which seem to indicate an issue with converting the images in the original PDF document.

Something interesting to note is that If we export the PDF in question in Adobe Acrobat using the ‘Optmised PDF’, the optimised PDF will convert into JPEGs with no issue

We can consistently reproduce the issue with more than one PDF document in fact.
Below is a cut down code snippet:

var resolution = new Aspose.Pdf.Devices.Resolution(150);
var pdfDocument = new Aspose.Pdf.Document(filePath);
for (var imageCount = 1; imageCount <= pdfDocument.Pages.Count; imageCount++) {
   // ... setting the imagePath with a numbering index '-1.jpg', '-2.jpg' and so on
   // ... setting  imgWidth, imgHeight with resizing algorithm
   using (var imageStream = new FileStream(imagePath, FileMode.Create))
      var jpegDevice = new Aspose.Pdf.Devices.JpegDevice(imgWidth, imgHeight, resolution, 100);
      jpegDevice.Process(pdfDocument.Pages[imageCount], imageStream);

Would you be able to provide assistance regarding this issue?
I have attached the problematic PDF as well as the flattened file for which the issue doesn’t occur, and a screenshot of both outputs
Looking forward to hearing whether you can reproduce this or not/

Thanks in advance

PDF with error.pdf (2.5 MB)
PDF optimised no error.pdf (3.5 MB)
screenshot.jpg (243.6 KB)



Thank you for contacting support.

We have worked with the data shared by you but we are unable to notice any difference with generated images. Kindly upgrade to Aspose.PDF for .NET 18.6 and then share your kind feedback with us.

In case the issue persists, please share a screenshot to elaborate the settings while optimizing source PDF file. So that we may investigate further to help you out.

Hi Farhan,

Thanks for your reply. I have upgraded to version 18.6 and can see that new version has most of those issues fixed.

Although I can still notice a issue in converting the following one pager PDF. The text ‘Research Fact’ disappears when converting to JPG.

Are you able to reproduce this on your end?

PDF one pager.pdf (447.9 KB)
Converted JPEG - text missing.jpg (627.9 KB)


We are glad to know that things have started working in your environment. Regarding the issue of text disappearing, we have been able to reproduce it in our environment. A ticket with ID PDFNET-44977 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Thank you for the assistance