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.