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

Free Support Forum - aspose.com

Missing content when converting PDF to image (png, jpeg) with Aspose.pdf. NET

Hi,

I’m facing an issue when converting a PDF to a png image (when converting to jpeg image too).
No error is thrown, but some text and labels are missing in the generated image.

I figured out that this behaviour occurs when the source pdf has been built by “PDF Creator Pilot 5.0.0.0”.

I’m using the latest version of Aspose.PDF (v23.12).
Here is the code I run :

public static void ConvertPdfToPng(string pdfFilename)
        {
            AsposeLicense.SetAsposePdfLicense();
            var pdfDocument = new Document(pdfFilename);

            foreach (var pdfPage in pdfDocument.Pages)
            {
                var pngFilename = pdfFilename.Replace(".pdf", $"{pdfPage.Number}.png");

                using (var imageFileStream = new FileStream(pngFilename, FileMode.Create))
                {
                    var resolution = new Resolution(300);
                    var pngDevice = new PngDevice(resolution);
                    pngDevice.Process(pdfPage, imageFileStream);
                    imageFileStream.Close();
                }
            }
        }

Here’s the source pdf : 5-22xB499xAVE408 - 2212231295.pdf (78.1 KB)

And the generated image : 5-22xB499xAVE408 - 22122312951.png (656.3 KB)

Thanks,
Thomas Nk.

@ThomasNk

We were able to reproduce the issue in our environment. Therefore, it has been logged as PDFNET-53414 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.