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);
imageStream.Close();
}
}
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)
Sammy