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

Generate thumbnail from a pdf document

We want to create a thumbnail from the first pdf page. 

How can we accomplish that in ASP.NET Core?


1 Reply

IJ Irfana Jaffer Sadhik Syncfusion Team February 1, 2023 02:26 PM UTC

We suspect your requirement is to create image from the pdf document. We have an API called ExportAsImage . This will help you to export the pdf page as an image. we have attached the code and sample for your reference. Please try this in your end and let us know the result.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Export_as_image_-_skia_sharp-1303382535

code used:

//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, 200, 200);

//Save the exported image in disk

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


Follow the below links for more information:

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


Loader.
Live Chat Icon For mobile
Up arrow icon