C# PDF to Image Code Example (Without Losing Quality)
using IronPdf;
using IronSoftware.Drawing;

var pdf = PdfDocument.FromFile("Example.pdf");

// Extract all pages to a folder as image files
pdf.RasterizeToImageFiles(@"C:\image\folder\*.png");

// Dimensions and page ranges may be specified
pdf.RasterizeToImageFiles(@"C:\image\folder\example_pdf_image_*.jpg", 100, 80);

// Extract all pages as AnyBitmap objects
AnyBitmap[] pdfBitmaps = pdf.ToBitmap();
NuGet Download
PM > Install-Package IronPdf
C# PDF to Image Code Example (Without Losing Quality)

C# PDF to Image Code Example (Without Losing Quality)

To convert a PDF document to images, call IronPDF's RasterizeToImageFiles method on a PdfDocument object. A PDF document can be loaded using the PdfDocument.FromFile method or one of the available PDF generation methods for .NET Core.

RasterizeToImageFiles renders each page of the PDF as a rasterized image. The first argument specifies the naming pattern to use for each image. Optional arguments can be used to customize the quality and dimensions for each image. Another option allows the method to convert selected pages from the PDF into images.

Line 13 of the featured code example demonstrates the ToBitmap method. Call this method on any PdfDocument object to quickly convert the PDF into AnyBitmap objects that can be saved to files or manipulated as needed.

Learn to Rasterize PDFs to Images with IronPDF
View on GitHub

Ready to Get Started?

Nuget Downloads 21,916,531Version:2026.11just released