Skip to main content

PDF to Image

Version: 4.0

Convert PDFs to Images

DynamicPDF Rasterizer for .NET efficiently and easily converts any PDF to a variety of image formats. It supports rasterizing PDFs to common image formats and offers a robust set of images and quality settings. The following C# examples show you how.

Watch the Video​

YouTube thumbnail: Watch video: How to Rasterize PDF in .NETWatch video: How to Rasterize PDF in .NET

How to Convert a PDF to an Image​

The following steps and C# sample code illustrates converting a PDF file to a variety of image formats.

Steps for Converting​

  1. Create a PdfRasterizer object instance using the source PDF document.
  2. Add the Draw method by specifying the file path to save the image, the image type as ImageFormat.jpeg, and the image size as ImageSize.Dpi72.
  3. Repeat step two, but change the file type to ImageFormat.png and ImageSize.Dpi300.
  4. Repeat step two, but change the file type to ImageFormat.tiff and ImageSize.Dpi300.

Sample code - C# (PDF to JPG)​

PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.jpg", ImageFormat.Jpeg, ImageSize.Dpi72);

Sample code - C# (PDF to PNG)​

PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.png", ImageFormat.Png, ImageSize.Dpi300);

Sample code - C# (PDF to TIFF)​

PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.png", ImageFormat.Png, ImageSize.Dpi300);

Converting a PDF to multi-page TIFF​

Create a multipage TIFF from a PDF by using the PdfRasterizer class's DrawToMultiPageTiff method. The following steps and C# sample code shows you how.

Steps for Converting​

  1. Create a PdfRasterizer object instance using the source PDF document.
  2. Add the DrawToMultiPageTiff method by specifying the file path to save the image, the image type as TiffWithCcitGroup4, and the image size as Dpi150.
  3. Repeat step two, but change the type to GIF.
  4. Repeat step two, but change the type to BMP.

Sample code - C# (Multi-page TIFF from PDF)​

PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.DrawToMultiPageTiff("output.tiff", ImageFormat.TiffWithCcitGroup4, ImageSize.Dpi150);

Sample code - C# (PDF to GIF)​

PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.gif", ImageFormat.Gif, ImageSize.Dpi150);

Sample code - C# (PDF to BMP)​

PdfRasterizer rasterizer = new PdfRasterizer("doc-a.pdf");
rasterizer.Draw("output.bmp", ImageFormat.Bmp, ImageSize.Dpi96);

PDF converted to four images.

GitHub Project​

Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This example contained on this page are in the following files.

View source on GitHub: Rasterizer .NET Examples

Getting Started​

Get started easily by installing DynamicPDF Rasterizer for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing.

NuGet Package​

The easiest way to install DynamicPDF Rasterizer for .NET is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.

Get ceTe.DynamicPDF.Rasterizer.NET from NuGet

DynamicPDF Rasterizer Information​

DynamicPDF Rasterizer for .NET is a user-friendly .NET library that quickly converts PDF documents to images. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Rasterizer for .NET today!