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
Syncfusion Feedback


Trusted by the world’s leading companies

Overview

The Syncfusion .NET PDF to image converter library uses PDFium to convert PDF documents into images. PDFium is used in Google Chrome for rendering PDF files. It provides accurate and robust PDF rendering.

It supports customization in image conversion, such as setting a transparent background and removing annotations from a specific page or a range of pages.

The PDF-to-image feature works seamlessly on different platforms: WinForms, WPF, Blazor, ASP.NET Core, and ASP.NET MVC.


How to convert PDF document to Image in C#

  • Install the Syncfusion.PdfToImageConverter NuGet package in your project.
  • Initialize a PdfToImageConverter class instance.
  • Load the PDF document from the stream into the image converter using the load method.
  • Convert the PDF pages into image streams using the Convert method.
  • Iterate through the output stream array, which contains image streams for each page, and save each image as a separate file.

Here is an example of how to convert a PDF document to an image in C# using the Syncfusion PDF to image converter library. You can convert PDF documents to images with just a few lines of code.

//Initialize the PDF to Image converter
PdfToImageConverter imageConverter = new PdfToImageConverter();
//Load the PDF document as a stream
FileStream inputStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.ReadWrite); 
imageConverter.Load(inputStream); 
//Convert PDF to Image
Stream[] outputStream = imageConverter.Convert(0, imageConverter.PageCount - 1, false, false); 
for (int i = 0; i < outputStream.Length; i++) { 
    File.WriteAllBytes("sample-" + i + ".png", (outputStream[i] as MemoryStream).ToArray());
}




Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon