Convert PDF to Image (.NET Core/Framework)

PDF documents can be quickly and easily be converted to images using DynamicPDF Rasterizer for .NET with just a few lines of code. It supports rasterizing PDFs to common image formats and offers a robust set of image and quality settings.

The following image types are supported:

  • PNG
  • TIFF, Multipage TIFF
  • GIF
  • BMP

How to Convert PDF to Image

Below are the steps and sample code to convert a PDF file to multiple image formats.

Steps to convert PDF to Image

  1. Create a PdfRasterizer object using the source PDF document.
  2. Call the Draw method by specifying the image type using ImageFormat, DPI and file path to save the images.

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);

Convert PDF to multipage TIFF

Multipage TIFF can be created from a PDF by using the DrawToMultiPageTiff method of the PdfRasterizer class. Here is the list of image formats available for PDF to TIFF image conversion.

  • ImageFormat.TiffWithLzw
  • ImageFormat.TiffWithCcitGroup4
  • ImageFormat.TiffWithCcitGroup3

Sample code - C# (Multipage 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);

Getting Started

NuGet Package

DynamicPDF Rasterizer for .NET is on NuGet with package ID ceTe.DynamicPDF.Rasterizer.NET.

NuGet Package ID: ceTe.DynamicPDF.Rasterizer.NET

Example Project

An example project showing this functionality can be cloned or viewed from GitHub:

Clone or View Example Project on GitHub

DynamicPDF Rasterizer Information

More information can be found here:

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 18 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!