using IronPdf;
// Disable local disk access or cross-origin requests
Installation.EnableWebSecurity = true;
// Instantiate Renderer
var renderer = new ChromePdfRenderer();
// Create a PDF from a HTML string using C#
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
// Export to a file or Stream
pdf.SaveAs("output.pdf");
// Advanced Example with HTML Assets
// Load external html assets: Images, CSS and JavaScript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
var myAdvancedPdf = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
myAdvancedPdf.SaveAs("html-with-assets.pdf");
Converting PDF documents to image files is a common requirement in modern .NET Framework and .NET Core applications. Whether you need to convert PDF pages to generate document thumbnails, extract images for web display, or convert PDF files for image processing workflows, having a reliable PDF library is essential. IronPDF provides a comprehensive .NET library solution to convert PDF to image with powerful rasterization capabilities, supporting multiple image formats and offering precise control over output quality and image DPI settings.
Why Do Developers Need to Convert PDF to Image in .NET?
PDF to image conversion serves critical purposes in document processing workflows. Developers frequently need to convert PDF pages to create thumbnail previews for document management systems, extract images, and generate image-based previews for websites where PDF content rendering isn't optimal without Adobe Reader, or process single PDF pages for OCR. Converting a PDF file to image files also enables easier sharing on platforms that don't support the PDF format and provides better compatibility with image processing components. Additionally, many compliance and archival systems require documents in specific image formats like TIFF for long-term storage. In most cases, developers need a reliable .NET wrapper that works fine across different environments.
How to Install IronPDF NuGet Package in Your .NET Project?
Getting started with IronPDF installation to convert PDF to an image is straightforward through NuGet Package Manager. Open your Visual Studio project in .NET Framework or .NET Core and access the Package Manager Console, then run this install command:
Install-Package IronPdf
Alternatively, download and install using the NuGet Package Manager UI by searching for "IronPDF" and clicking install. This free component works fine with all .NET versions. After installation, add the namespace to your code file:
using IronPdf;
using System;
using System.Drawing;
using IronPdf;
using System;
using System.Drawing;
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText $csharpLabel
For the simplest PDF to image conversion scenario, you can convert an entire PDF document to high-quality PNG or JPG images with just two lines of code in this sample:
var pdf = PdfDocument.FromFile("invoice.pdf");
pdf.RasterizeToImageFiles(@"C:\images\folder\page_*.png");
var pdf = PdfDocument.FromFile("invoice.pdf");
pdf.RasterizeToImageFiles(@"C:\images\folder\page_*.png");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText $csharpLabel
This code loads a single PDF file using the PdfDocument.FromFile method and converts all PDF pages to PNG image files. The RasterizeToImageFiles method automatically handles multiple pages in PDF documents, creating separate image files for each page with sequential numbering in the output folder. Note that the asterisk in the file path acts as a placeholder for automatic page numbering.
Input
Output
How to Convert Specific PDF Pages to Different Image Formats?
IronPDF excels at providing granular control over the PDF-to-image conversion process. You can convert PDF pages selectively, control quality settings, and choose from multiple output image formats to meet your exact requirements. Unlike basic Poppler tools or GPL programs, this .NET library offers comprehensive control.
Converting Selected Pages from PDF to JPG
To convert specific PDF pages rather than the entire PDF document, use the page range parameter in this example:
// Event handler example for Windows Forms application
private void ConvertButton_Click(object sender, EventArgs e)
{
var pdf = PdfDocument.FromFile("report.pdf");
var pageRange = Enumerable.Range(0, 5); // First 5 pages
pdf.RasterizeToImageFiles(
@"C:\output\page_*.jpg",
pageRange,
1920, // Width in pixels
1080, // Height in pixels
IronPdf.Imaging.ImageType.Jpeg,
150 // Image DPI setting
);
}
// Event handler example for Windows Forms application
private void ConvertButton_Click(object sender, EventArgs e)
{
var pdf = PdfDocument.FromFile("report.pdf");
var pageRange = Enumerable.Range(0, 5); // First 5 pages
pdf.RasterizeToImageFiles(
@"C:\output\page_*.jpg",
pageRange,
1920, // Width in pixels
1080, // Height in pixels
IronPdf.Imaging.ImageType.Jpeg,
150 // Image DPI setting
);
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText $csharpLabel
This sample converts the first page through the fifth page to JPEG image format with specified dimensions. The method parameters give you complete control to convert PDF files: define the output path pattern for naming conventions, select a single PDF page or multiple pages for partial conversion, set maximum width and height in pixels while maintaining aspect ratio, choose the image format (JPEG, PNG, TIFF, or BMP), and specify the DPI resolution for print-quality output. The image rasterization process preserves text clarity and graphics quality throughout the PDF to JPG conversion.
Converting from Website URL to Images
IronPDF can also render web pages to PDF and then convert to image files in this post-processing workflow:
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://ironpdf.com/");
pdf.RasterizeToImageFiles(@"C:\web\screenshot_*.png");
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://ironpdf.com/");
pdf.RasterizeToImageFiles(@"C:\web\screenshot_*.png");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText $csharpLabel
This approach captures website content exactly as it appears in the Chrome browser, then converts each PDF page to PNG images. The ChromePdfRenderer component ensures accurate rendering of modern web technologies, including JavaScript, CSS3, and responsive layouts with proper background colors, making it perfect for creating website screenshots or archiving web content. The render method works fine across all platforms.
Input
Output
What Image Formats and Quality Settings Are Available to Convert PDF?
IronPDF supports all major image formats with customizable quality settings for different use cases in .NET Framework and .NET Core applications. This open source-friendly library provides more options than basic Poppler utilities.
PNG Format - Ideal for PDF documents requiring transparency or lossless compression. Perfect for technical drawing, screenshots, and documents where text clarity is crucial. PNG ensures no quality loss during PDF rasterization and works fine for web display.
JPEG/JPG Format - Best for photographs and complex images where smaller file sizes are needed. The PDF to JPG converter supports quality adjustment for balancing file size versus image clarity in web applications. Save space without sacrificing visual quality.
TIFF Format - Excellent for archival purposes, supporting both single and multi-page TIFF documents. IronPDF's ability to create multi-page TIFF files from PDF pages is particularly valuable for document management systems:
// Convert PDF to multi-page TIFF - all pages in single file
var pdf = PdfDocument.FromFile("multipage.pdf");
pdf.ToMultiPageTiffImage(@"C:\archive\document.tiff", null, null, 300);
// Process complete - single TIFF contains all pages
Console.WriteLine("PDF converted to multi-page TIFF");
// Convert PDF to multi-page TIFF - all pages in single file
var pdf = PdfDocument.FromFile("multipage.pdf");
pdf.ToMultiPageTiffImage(@"C:\archive\document.tiff", null, null, 300);
// Process complete - single TIFF contains all pages
Console.WriteLine("PDF converted to multi-page TIFF");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText $csharpLabel
This creates a single TIFF file containing all PDF pages from the PDF document, maintaining document integrity while meeting archival standards. The 300 DPI setting ensures high-resolution output suitable for long-term storage and compliance requirements. Multi-page TIFF is especially useful for fax systems, medical imaging, and legal document archiving, where all pages must remain in a single file. Note that this feature distinguishes IronPDF from simpler conversion tools.
BMP Format - Provides uncompressed bitmap output when maximum quality without compression artifacts is required for System.Drawing image processing workflows in Windows applications.
Resolution control through DPI (dots per inch) settings allows optimization for different scenarios: 72-96 DPI for web display and thumbnail generation, 150-200 DPI for general document viewing, and 300+ DPI for print-quality output and OCR processing. The image DPI directly affects file size and quality.
What Advanced Capabilities Does IronPDF Offer for PDF to Image Conversion?
IronPDF's image conversion features extend beyond basic PDF rasterization. The .NET library provides full cross-platform support, running seamlessly on Windows, Linux, and macOS environments without requiring Adobe Reader. Container deployment is fully supported with Docker and Kubernetes, making it ideal for cloud-native .NET Core applications. For high-volume PDF file processing, async methods enable efficient batch conversion without blocking application threads. The library also handles complex PDF content, including form fields, annotations, and encrypted documents. Unlike free Poppler tools, IronPDF provides commercial-grade reliability with professional support.
Conclusion
IronPDF transforms PDF to image conversion from a complex task into a simple, reliable process for .NET developers. With support for multiple image formats, including multi-page TIFF, precise image DPI control, and cross-platform compatibility, it provides everything needed to convert PDF documents to image files in your workflows. The straightforward API means you can implement sophisticated PDF rasterization logic with minimal code while maintaining excellent output quality across PNG, JPEG, TIFF, and BMP formats. Whether you need to extract images from a single PDF page or convert entire documents, IronPDF works fine in most cases.
Experience IronPDF's powerful PDF to image converter capabilities with a free trial designed to fit projects of any scale. Visit our comprehensive documentation to discover more PDF manipulation features and download the complete sample code from the article.
Chipego has a natural skill for listening that helps him to comprehend customer issues, and offer intelligent solutions. He joined the Iron Software team in 2023, after studying a Bachelor of Science in Information Technology. IronPDF and IronOCR are the two products Chipego has been focusing on, but his knowledge of ...Read More