We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Export as image running slowly

I was given a document that is timing out in our system because of the length of time it takes for each page to export (15 to 30 seconds), however when this document is re-printed to pdf it works fine.
this is how we're exporting each page.

            for (int i = 0; i < loadedDocument.Pages.Count; i++)

            {

                var imageBitmap = loadedDocument.ExportAsImage(i);

                var imageBytes = this.ImageToByte(imageBitmap);

                images.Add(Convert.ToBase64String(imageBytes));

                imageBitmap.Dispose();

            }


Attachment: cdca54f9b47c4810a8dcb5ae7ca0429d_518dad62.zip

2 Replies 1 reply marked as answer

IJ Irfana Jaffer Sadhik Syncfusion Team April 13, 2023 10:54 AM UTC

We suggest using our Syncfusion PDFViewer library functionality to export the pages of the PDF document without the mentioned timeout. We have included a sample for your reference. Try this on your end and let us know the result.


code sample:

//Uses the Syncfusion.EJ2.PdfViewer assembly

PdfRenderer pdfExportImage = new PdfRenderer();

//Loads the PDF document

pdfExportImage.Load(@"currentDirectory\..\..\..\..\Data\HTTP Succinctly.pdf");

//Exports the PDF document pages into images

Bitmap bitmapimage = pdfExportImage.ExportAsImage(0);

//Save the exported image in disk

bitmapimage.Save(@"currentDirectory\..\..\..\..\Images\" + "bitmapImage" + i.ToString() + ".png");



Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionFieldTest1515731788

We request you refer to the following NuGet package to achieve this requirement:

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Mvc5


Follow the below links for more information,

https://ej2.syncfusion.com/aspnetcore/documentation/pdfviewer/how-to/export-as-image

https://www.syncfusion.com/blogs/post/pdf-to-image-conversion-is-made-easy-with-wpf-pdf-viewer.aspx


Marked as answer

CT Corey Thornton April 18, 2023 05:29 PM UTC

Thanks this did work on that document within our timeout


Loader.
Live Chat Icon For mobile
Up arrow icon