C# PDF to Image Code Example (Without Losing Quality)
Use IronPDF to convert a PDF to images in your preferred file type, image dimensions, and DPI 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.
RasterizeToImageFiles
renders each page of the 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 one causes the method to convert selected pages from the PDF into images.
Line 24 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.
How to Convert a PDF to Images in C#
- Install the PDF to image C# library
- Import existing PDF file with
FromFile
method - Convert PDF to image using
RasterizeToImageFiles
method - Specify save directory and image size
- Check the output images