PdfLoadedDocument.ExportAsImage not working as expected

With certain PDF documents the ExportAsImage function produces images that are missing a lot of the page content.
I have attached a zip with an example file, example MVC project, and images showing the actual output vs expected output.

You can reproduce this issue using the example code by uploading the PDF named "Input File" then clicking submit. The code will then run ExportAsImage as display the result. You can see that the result image does not have most of the text or images that were part of the document.

Attachment: asp_pdf_3d09a858.zip

3 Replies 1 reply marked as answer

MS Mohan Selvaraj Syncfusion Team August 21, 2020 08:00 AM UTC

Hi Michael, 

We can reproduce the reported issue with the provide code-snippet. However we can resolve the reported issue by using our Syncfusion.EJ2.PdfViewer.AspNet.Mvc5 NuGet. In this we have using the Pdfium rendering engine for exporting the pdf pages to images. We have also modified the provided sample , Kindly download it from the below link. 

PdfRenderer pdfExportImage = new PdfRenderer(); 
            pdfExportImage.Load(fileData); 
            Bitmap image = pdfExportImage.ExportAsImage(0, new SizeF(200, 300), true); 
            using (var ms = new MemoryStream()) 
            { 
                image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); 
                TempData["imagedata"] = Convert.ToBase64String(ms.ToArray()); 
            } 
            pdfExportImage.Dispose(); 



Regards, 
Mohan S 
 


Marked as answer

MB Michael Burgess August 25, 2020 10:55 PM UTC

Thanks Mohan,
I have tested your sample and can confirm it is working for us.


MS Mohan Selvaraj Syncfusion Team August 26, 2020 07:05 AM UTC

Hi Michael,  

Thank you for your update. We are glad to know that the reported issue is resolved. Please revert us if you need further assistance.   

Regards,  
Mohan S

Loader.
Up arrow icon