Free Support Forum -

Missing parts of image when exporting from layered PDF to JPG

I am running into problems when converting layered PDFs to JPGs.

I have a sample PDF (which I believe has an invisible layer in it) which can be converted to a JPG using the jpegDevice.Process() function. However when I open the JPG, large areas of the image are missing.

I’ve used my code with other PDFs and they seem to convert correctly:

Dim sizeThumbnails As Integer = 600
Dim smallestDPI As Integer = 72

Dim pdfDocument As New Aspose.Pdf.Document(sInFile)

Using imageStream As New FileStream(sOutFile, FileMode.Create)
’ Height and width in points (1/72 inch)
Dim pageHeight As Double = pdfDocument.Pages(1).Rect.Height
Dim pageWidth As Double = pdfDocument.Pages(1).Rect.Width

’ Work out the smallest DPI
Dim screenDPI As Integer = 72
Dim horizontalDPI As Integer = Convert.ToInt32((sizeThumbnails / pageWidth) * screenDPI)
Dim verticalDPI As Integer = Convert.ToInt32((sizeThumbnails / pageHeight) * screenDPI)

If (horizontalDPI < verticalDPI) Then
smallestDPI = horizontalDPI
smallestDPI = verticalDPI
End If

Dim resolution As New Devices.Resolution(smallestDPI)
Dim jpegDevice As New Devices.JpegDevice(resolution, 80)

'convert a particular page and save the image to stream
jpegDevice.Process(pdfDocument.Pages(1), imageStream)

'close stream
End Using

The source PDF and the converted JPG files are attached. I’m using Aspose.Pdf v7.0.0.0

Cheers, Bruce.

Hi Bruce,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template files.

I am able to generate your mentioned issue after an initial test. For rectification, your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34145. You will be notified via this forum thread regarding any updates against your reported issue.

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWNET-34145) have been fixed in Aspose.Pdf for .NET 7.7.0.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.


Thanks for the update. I've just downloaded and installed the latest Aspose.Total and have then installed Aspose.Pdf v7.7.0.

I've re-run my test on that PDF (the Anzac Day BBQ), but I get exactly the same result as when I first reported the problem. The JPG is saved with a wide white band around the top and left sides of the image.


Hi Bruce,

Thanks for sharing the feedback. I have again tested the scenario using Aspose.Pdf for .NET 7.7.0 and as per my observations, the issue is not occurring. For your reference, I have also attached the resultant image file which is generated over my end. Can you please ensure that the new product version is included in your project. We are sorry for this inconvenience.

Apologies, I had a problem in my conversion code. The latest version is working perfectly.

Cheers, Bruce.

Hi Bruce,

I am glad to hear that your problem is resolved. Please continue using our products and in case of any further query, please feel free to contact.