How to export the PDF pages to images in ASP.NET MVC (Classic)?
We can export the pages of the PDF document to images using the ExportAsImage functionality in PdfViewerControl as in the below code snippet.
HomeController.cs
//Creating new instance for PdfViewerControl
PdfViewerControl viewerControl = new PdfViewerControl(); //Loading the PDF document from the physical path
viewerControl.LoadDocument(path); //Exporting PDF Document to image as Bitmap
Bitmap[] image = viewerControl.ExportAsImage(0,viewerControl.PageCount-1);
for (int i = 0; i < viewerControl.PageCount; i++) { //Save the Document into local disk image[i].Save(ā€¯OutputImage_" + i + ".png",ImageFormat.Png); } |
Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/ExportAsImage-331838386
Run the sample and click Export button. The exported images are saved in Output folder.
Conclusion
I hope you enjoyed learning about how to export the PDF pages to images in ASP.NET MVC PDF.
You can refer to our ASP.NET MVC PDF Viewer feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC PDF Viewer Example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!