Converting PDF pages to images
Convert each page in a multi-page PDF into a separate image file. Use this approach when you need per-page previews, thumbnails, or image-based processing for individual pages.
How Nutrient supports this workflow
Here’s how the Nutrient .NET SDK handles image export for multi-page PDFs.
When you export a multi-page PDF as PNG, JPEG, or BMP, the SDK writes one numbered file for each page. The destination filename acts as a template. For example, output.png becomes output-1.png, output-2.png, and so on.
For TIFF output, the SDK writes all pages to a single multi-page file. If you need single-file TIFF output, refer to the PDF to image guide.
You don’t need to:
- Iterate through pages yourself
- Create per-page filenames
- Render each page to a bitmap before saving
The SDK handles page iteration and file numbering.
Complete implementation
The following example exports each page from a multi-page PDF as a separate PNG file.
Import the Nutrient namespace:
using Nutrient;Open the multi-page PDF with a using declaration(opens in a new tab), export it as PNG, and report the page count with the PageCount property. The SDK detects the output format from the .png extension and writes one file for each page:
try{ using Document document = Document.Open("input.pdf"); document.ExportAsImage("output.png"); Console.WriteLine($"Converted {document.PageCount} page(s); see output-1.png, output-2.png, ...");}catch (NutrientException e){ Console.Error.WriteLine($"Error: {e.Message}"); Environment.Exit(1);}Output
For a multi-page input PDF, this call writes numbered files like:
output-1.pngoutput-2.png
The original output.png filename serves as the template. The SDK appends -N before the file extension for each page, using one-based numbering.
For single-page documents, the SDK keeps the literal filename unchanged. For that workflow, refer to the PDF to image guide.
Choosing the format
The output behavior depends on the file format you choose.
| Format | Multi-page behavior |
|---|---|
TIFF (.tiff, .tif) | All pages are embedded in one file |
PNG (.png) | One numbered file per page |
JPEG (.jpg, .jpeg) | One numbered file per page |
BMP (.bmp) | One numbered file per page |
To override extension-based format detection, set the export format with the ImageSettings.ExportFormat property before calling ExportAsImage.
Summary
The overall process matches the single-page workflow. You choose the output format with the file extension, and the SDK exports each page using the appropriate file pattern.