Pdf To Image Converter Using Syncfusion .NET PDF Library
Overview
This PDF to image converter library allows converting PDF documents to images without opening the document in the PDF Viewer control. It allows you to selectively export pages as a stream by utilizing the ‘Convert’ method, facilitating the transformation of PDF files into images.
Quick Start Examples
Example 1: Generate Code
User: "Show me the C# code to convert pdf to image."
Result: C# code snippet displayed (no files created)
One Mode
Mode 1: Generate C# Code for the User's Project (default)
Use this mode when the user wants to view, write, review, refactor, or modify C# code related to pdf to image conversion processing. Licensing, authentication, and secret configuration are out of scope.
Trigger keywords: "show me how", "how to", "how can I", "how do I", "provide code", "provide an example", "give an example", "demonstrate", "code snippet", "sample code", "example", "sample", "give me", "show me", "Program.cs", "example code", "generate code for", "codesnippet".
Workflow:
Step 1 — Detect Application Type and Suggest Required NuGet Packages
Inspect the workspace project files (.csproj, web.config, App.config, Startup.cs, Program.cs, etc.) and use the detection signals table in references/nuget-packages.md to determine the application type.
Based on the detected application type, identify the correct NuGet package(s) from references/nuget-packages.md and instruct the user to install them before generating any code.
Step 2 — Generate Code from Reference Files Only
Do NOT invent, guess, or suggest any API, method, property, class, or namespace not explicitly present in the reference files.
- Read the relevant
references/*.md file(s) for the requested feature
- Build C# code strictly from the APIs and snippets found in those files.
- Exclude any licensing, authentication, or secret‑handling logic.
- Do not create or run any
.csx script
API Summary
| API / Property |
Purpose |
new PdfToImageConverter(stream) |
Loads a PDF document from a stream via constructor |
new PdfToImageConverter(stream, password) |
Loads an encrypted PDF document from a stream via constructor |
imageConverter.Load(stream) |
Loads a PDF document from a stream using the Load method |
imageConverter.Load(stream, password) |
Loads an encrypted PDF document from a stream using the Load method |
imageConverter.Convert(pageIndex, keepTransparency, isSkipAnnotations) |
Converts a single PDF page to an image stream |
imageConverter.Convert(startPage, endPage, keepTransparency, isSkipAnnotations) |
Converts a range of PDF pages to an array of image streams |
imageConverter.Convert(pageIndex, SizeF, keepAspectRatio, keepTransparency, isSkipAnnotations) |
Converts a PDF page to an image with a custom width and height |
imageConverter.Convert(startPage, endPage, dpiX, dpiY, keepTransparency, isSkipAnnotations) |
Converts a range of PDF pages to images at a custom DPI resolution (MVC / WinForms / WPF) |
imageConverter.Convert(pageIndex, zoomFactor, tileXCount, tileYCount, tileX, tileY) |
Converts a PDF page to an image using zoom factor and tile matrix coordinates (ASP.NET Core / Blazor) |
imageConverter.Convert(startPageIndex, endPageIndex, SizeF, dpiX, dpiY, keepAspectRatio, keepTransparency, isSkipAnnotations) |
Converts a range of PDF pages to image streams with a custom size and DPI resolution (MVC / WinForms / WPF) |
imageConverter.Convert(startPageIndex, endPageIndex, SizeF, keepAspectRatio, keepTransparency, isSkipAnnotations) |
Converts a range of PDF pages to image streams with a custom width and height. |
imageConverter.Convert(pageIndex, SizeF, dpiX, dpiY,keepAspectRatio, keepTransparency, isSkipAnnotations) |
Converts a single PDF page to an image with a custom size and DPI. |
imageConverter.Dispose() |
Releases all resources used by the PdfToImageConverter. |
imageConverter.PageCount |
Gets the total number of pages in the loaded PDF document |
imageConverter.ScaleFactor |
Sets the scale factor to enhance output image quality (default: 1.5f) |
imageConverter.ReferencePath |
Sets a custom folder path for PDFium binary extraction in restricted-access environments |
Code References
All templates and snippets are in the references/ folder:
| File |
Contents |
nuget-packages.md |
Lists the required NuGet packages for PDFToImageConverter per target platform, with application-type detection signals |
load.md |
Loads a PDF document (plain or encrypted) as a stream into PdfToImageConverter using the constructor or the Load method. After the conversion, dispose of the PdfToImageConverter using the Dispose method |
customizing-conversion.md |
Converts PDF pages to images — single page, page range, custom size, custom DPI, and zoom/tile resolution |
multithreading-pdf-to-image.md |
Converts PDF pages to images using multithreading — via Task-based async and Parallel.For patterns |
Rules
- Output files go in
./output/ directory
- Don't use any API which is not in reference
Prerequisites
- Install required runtime and library packages from NuGet before generating code.
- .NET SDK 8+
1---2name: syncfusion-dotnet-pdf-to-image3description: Convert PDF files to images with customization options (output format, DPI, pages, scaling, and image quality). Supports one mode — generate C# code for the user's project.4---56# Pdf To Image Converter Using Syncfusion .NET PDF Library7## Overview8This PDF to image converter library allows converting PDF documents to images without opening the document in the PDF Viewer control. It allows you to selectively export pages as a stream by utilizing the ‘Convert’ method, facilitating the transformation of PDF files into images.910## Quick Start Examples1112### Example 1: Generate Code13**User:** "Show me the C# code to convert pdf to image."14**Result:** C# code snippet displayed (no files created)1516## One Mode1718### Mode 1: Generate C# Code for the User's Project *(default)*19Use this mode when the user wants to view, write, review, refactor, or modify C# code related to pdf to image conversion processing. Licensing, authentication, and secret configuration are out of scope.2021**Trigger keywords:** "show me how", "how to", "how can I", "how do I", "provide code", "provide an example", "give an example", "demonstrate", "code snippet", "sample code", "example", "sample", "give me", "show me", "Program.cs", "example code", "generate code for", "codesnippet".2223**Workflow:**2425#### Step 1 — Detect Application Type and Suggest Required NuGet Packages26- Inspect the workspace project files (`.csproj`, `web.config`, `App.config`, `Startup.cs`, `Program.cs`, etc.) and use the detection signals table in `references/nuget-packages.md` to determine the application type.2728- Based on the detected application type, identify the correct NuGet package(s) from references/nuget-packages.md and instruct the user to install them before generating any code.2930#### Step 2 — Generate Code from Reference Files Only3132> **Do NOT invent, guess, or suggest any API, method, property, class, or namespace not explicitly present in the reference files.**3334- Read the relevant `references/*.md` file(s) for the requested feature35- Build C# code **strictly** from the APIs and snippets found in those files.36- Exclude any licensing, authentication, or secret‑handling logic.37- Do **not** create or run any `.csx` script38---3940## API Summary4142| API / Property | Purpose |43|---|---|44| `new PdfToImageConverter(stream)` | Loads a PDF document from a stream via constructor |45| `new PdfToImageConverter(stream, password)` | Loads an encrypted PDF document from a stream via constructor |46| `imageConverter.Load(stream)` | Loads a PDF document from a stream using the Load method |47| `imageConverter.Load(stream, password)` | Loads an encrypted PDF document from a stream using the Load method |48| `imageConverter.Convert(pageIndex, keepTransparency, isSkipAnnotations)` | Converts a single PDF page to an image stream |49| `imageConverter.Convert(startPage, endPage, keepTransparency, isSkipAnnotations)` | Converts a range of PDF pages to an array of image streams |50| `imageConverter.Convert(pageIndex, SizeF, keepAspectRatio, keepTransparency, isSkipAnnotations)` | Converts a PDF page to an image with a custom width and height |51| `imageConverter.Convert(startPage, endPage, dpiX, dpiY, keepTransparency, isSkipAnnotations)` | Converts a range of PDF pages to images at a custom DPI resolution (MVC / WinForms / WPF) |52| `imageConverter.Convert(pageIndex, zoomFactor, tileXCount, tileYCount, tileX, tileY)` | Converts a PDF page to an image using zoom factor and tile matrix coordinates (ASP.NET Core / Blazor) |53| `imageConverter.Convert(startPageIndex, endPageIndex, SizeF, dpiX, dpiY, keepAspectRatio, keepTransparency, isSkipAnnotations)` | Converts a range of PDF pages to image streams with a custom size and DPI resolution (MVC / WinForms / WPF) |54| `imageConverter.Convert(startPageIndex, endPageIndex, SizeF, keepAspectRatio, keepTransparency, isSkipAnnotations)` |Converts a range of PDF pages to image streams with a custom width and height. |55| `imageConverter.Convert(pageIndex, SizeF, dpiX, dpiY,keepAspectRatio, keepTransparency, isSkipAnnotations)` |Converts a single PDF page to an image with a custom size and DPI. |56| `imageConverter.Dispose()` |Releases all resources used by the PdfToImageConverter. |57| `imageConverter.PageCount` | Gets the total number of pages in the loaded PDF document |58| `imageConverter.ScaleFactor` | Sets the scale factor to enhance output image quality (default: `1.5f`) |59| `imageConverter.ReferencePath` | Sets a custom folder path for PDFium binary extraction in restricted-access environments |6061---6263## Code References6465All templates and snippets are in the `references/` folder:6667| File | Contents |68|---|---|69| `nuget-packages.md` | Lists the required NuGet packages for PDFToImageConverter per target platform, with application-type detection signals |70| `load.md` | Loads a PDF document (plain or encrypted) as a stream into PdfToImageConverter using the constructor or the Load method. After the conversion, dispose of the PdfToImageConverter using the Dispose method |71| `customizing-conversion.md` | Converts PDF pages to images — single page, page range, custom size, custom DPI, and zoom/tile resolution |72| `multithreading-pdf-to-image.md` | Converts PDF pages to images using multithreading — via Task-based async and Parallel.For patterns |7374---7576## Rules7778- Output files go in `./output/` directory79- Don't use any API which is not in reference8081## Prerequisites8283- Install required runtime and library packages from NuGet before generating code.84- .NET SDK 8+