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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export the PDF pages to images in ASP.NET(classic)?

Platform: WinForms |
Control: PdfViewer

How to export the PDF pages to images in ASP.NET (classic)?

At present, there is no support to export PDF pages as images in ASP.NET (Classic). However, you can export the PDF Document pages as images by using ExportAsImage functionality available with PdfViewer.Windows as in the below code snippets.


<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<table width="100%" style="color: #5D6B03" border="1px">
<tr style="width: 100%; background-color: #8EA718; text-align:center">
<td >
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="ExportAsImage" />



protected void Button1_Click(object sender, EventArgs e)
if (System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName).Equals(".pdf"))
//locate the file path and the path the images to be saved
string imagePath = Server.MapPath("~/Images/");
//Clear the previous pdf file images from the Images folder
//Get the pdf file stream
Stream pdfStream = FileUpload1.PostedFile.InputStream;
//Create an instance of PdfViewerControl
PdfViewerControl pdfViewercontrol = new PdfViewerControl();
//Load the document in the viewer
//Export the pages of the loaded document as bitmap images
System.Drawing.Bitmap[] images = pdfViewercontrol.ExportAsImage(0, pdfViewercontrol.PageCount - 1);
int page = 0;
//Save the images in the imagepath defined earlier
foreach (System.Drawing.Bitmap bmp in images)
images[page].Save(imagePath + "exportedPage_" + page.ToString() + ".png", System.Drawing.Imaging.ImageFormat.Png);
/// <summary>
///Clear the Folder.
/// </summary>
/// <param name="folderName"></param>
private void ClearFolder(string folderName)
DirectoryInfo directoryInfo = new DirectoryInfo(folderName);
foreach (FileInfo fileInfo in directoryInfo.GetFiles())
fileInfo.IsReadOnly = false;




2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile