Convert Images to PDFs in C#

GdPicture.NET SDK enables you to convert PDF documents to more than 10 image file formats.

PSPDFKit SDKs are deployed in some of the world’s most popular applications, such as those made by Autodesk, Disney, UBS, Dropbox, IBM, and Lufthansa.

Key Capabilities

  • PDF to TIFF — Convert to TIFF from PDF

  • PDF to JPG — Convert to JPG from PDF

  • PDF to PNG — Convert to PNG from PDF

  • PDF to BMP — Convert to BMP from PDF

  • PDF to SVG — Convert to SVG from PDF

  • PDF to other image formats — Convert to other image formats from PDF

Guides for PDF-to-Image Conversion

Convert from PDF to TIFF
How to convert to TIFF from PDF

Convert from PDF to JPG
How to convert to JPG from PDF

Convert from PDF to PNG
How to convert to PNG from PDF

Convert from PDF to BMP
How to convert to BMP from PDF

Convert from PDF to SVG
How to convert to SVG from PDF

Convert from PDF to other image formats
How to convert to other image formats from PDF

Free Trial

Start your free trial for unlimited access and expert support.

To convert PDF documents to TIFF image files, choose one of the following options:

  • Create a multipage TIFF file from all the pages in the PDF document.

  • Create a single-page TIFF file from one page in the PDF document.

Creating a TIFF File from All Pages in a PDF

To create a TIFF file from all pages in a PDF document, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source image by passing its path to the LoadFromFile method. Recommended: Specify the source image format with a member of the DocumentFormat enumeration.

  3. Optional: Use the RasterizationDPI property of the GdPictureDocumentConverter object to specify the resolution, expressed in dots per inch (DPI), with which to convert raster images in the source PDF to vector images in the output TIFF file.

  4. Save the output TIFF file by passing its path to the SaveAsTIFF method. Optional: Specify the compression scheme used in the conversion with the TiffCompression enumeration.

The example below creates a TIFF file from a PDF document:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF);
// Configure the conversion.
gdpictureDocumentConverter.RasterizationDPI = 300;
// Save the output in a new TIFF file.
gdpictureDocumentConverter.SaveAsTIFF(@"C:\temp\output.tiff", TiffCompression.TiffCompressionAUTO);
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF)
    ' Configure the conversion.
    gdpictureDocumentConverter.RasterizationDPI = 300
    ' Save the output in a new TIFF file.
    gdpictureDocumentConverter.SaveAsTIFF("C:\temp\output.tiff", TiffCompression.TiffCompressionAUTO)
End Using
Used Methods

Related Topics

Creating a TIFF File from a PDF Page

To create a TIFF image from a page in a PDF document, follow these steps:

  1. Create a GdPicturePDF object and a GdPictureImaging object.

  2. Load the source document by passing its path to the LoadFromFile method of the GdPicturePDF object.

  3. Select the page that you want to convert to an image with the SelectPage method of the GdPicturePDF object.

  4. Render the selected page to a 200 dots-per-inch (DPI) image with the RenderPageToGdPictureImageEx method of the GdPicturePDF object.

  5. Save the output in a new TIFF image with the SaveAsTIFF method. Specify the compression scheme used in the conversion with the TiffCompression enumeration.

The example below creates a TIFF image from the first page of a PDF document:

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source PDF document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF.
gdpicturePDF.SelectPage(1);
// Render the selected page to an image.
int imageId = gdpicturePDF.RenderPageToGdPictureImageEx(200, true);
// Save the output in a new TIFF image.
gdpictureImaging.SaveAsTIFF(imageId, @"C:\temp\output.tiff", TiffCompression.TiffCompressionAUTO);
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
gdpicturePDF.CloseDocument();
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Load the source PDF document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF.
    gdpicturePDF.SelectPage(1)
    ' Render the selected page to an image.
    Dim imageId As Integer = gdpicturePDF.RenderPageToGdPictureImageEx(200, True)
    ' Save the output in a new TIFF image.
    gdpictureImaging.SaveAsTIFF(imageId, "C:\temp\output.tiff", TiffCompression.TiffCompressionAUTO)
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
    gdpicturePDF.CloseDocument()
End Using
End Using
Used Methods

Related Topics

To create a JPG image from a page in a PDF document, follow these steps:

  1. Create a GdPicturePDF object and a GdPictureImaging object.

  2. Load the source document by passing its path to the LoadFromFile method of the GdPicturePDF object.

  3. Select the page that you want to convert to an image with the SelectPage method of the GdPicturePDF object.

  4. Render the selected page to a 200 dots-per-inch (DPI) image with the RenderPageToGdPictureImageEx method of the GdPicturePDF object.

  5. Save the output in a JPG image with the SaveAsJPEG method.

The example below creates a JPG image from the first page of a PDF document:

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source PDF document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF.
gdpicturePDF.SelectPage(1);
// Render the selected page to an image.
int imageId = gdpicturePDF.RenderPageToGdPictureImageEx(200, true);
// Save the output in a JPG image.
gdpictureImaging.SaveAsJPEG(imageId, @"C:\temp\output.jpg");
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
gdpicturePDF.CloseDocument();
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Load the source PDF document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF.
    gdpicturePDF.SelectPage(1)
    ' Render the selected page to an image.
    Dim imageId As Integer = gdpicturePDF.RenderPageToGdPictureImageEx(200, True)
    ' Save the output in a JPG image.
    gdpictureImaging.SaveAsJPEG(imageId, "C:\temp\output.jpg")
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
    gdpicturePDF.CloseDocument()
End Using
End Using
Used Methods

Related Topics

To create a PNG image from a page in a PDF document, follow these steps:

  1. Create a GdPicturePDF object and a GdPictureImaging object.

  2. Load the source document by passing its path to the LoadFromFile method of the GdPicturePDF object.

  3. Select the page that you want to convert to an image with the SelectPage method of the GdPicturePDF object.

  4. Render the selected page to a 200 dots-per-inch (DPI) image with the RenderPageToGdPictureImageEx method of the GdPicturePDF object.

  5. Save the output in a PNG image with the SaveAsPNG method.

The example below creates a PNG image from the first page of a PDF document:

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source PDF document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF.
gdpicturePDF.SelectPage(1);
// Render the selected page to an image.
int imageId = gdpicturePDF.RenderPageToGdPictureImageEx(200, true);
// Save the output in a PNG image.
gdpictureImaging.SaveAsPNG(imageId, @"C:\temp\output.png");
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
gdpicturePDF.CloseDocument();
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Load the source PDF document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF.
    gdpicturePDF.SelectPage(1)
    ' Render the selected page to an image.
    Dim imageId As Integer = gdpicturePDF.RenderPageToGdPictureImageEx(200, True)
    ' Save the output in a PNG image.
    gdpictureImaging.SaveAsPNG(imageId, "C:\temp\output.png")
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
    gdpicturePDF.CloseDocument()
End Using
End Using
Used Methods

Related Topics

To create a BMP image from a page in a PDF document, follow these steps:

  1. Create a GdPicturePDF object and a GdPictureImaging object.

  2. Load the source document by passing its path to the LoadFromFile method of the GdPicturePDF object.

  3. Select the page that you want to convert to an image with the SelectPage method of the GdPicturePDF object.

  4. Render the selected page to a 200 dots-per-inch (DPI) image with the RenderPageToGdPictureImageEx method of the GdPicturePDF object.

  5. Save the output in a BMP image with the SaveAsBMP method.

The example below creates a BMP image from the first page of a PDF document:

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source PDF document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF.
gdpicturePDF.SelectPage(1);
// Render the selected page to an image.
int imageId = gdpicturePDF.RenderPageToGdPictureImageEx(200, true);
// Save the output in a BMP image.
gdpictureImaging.SaveAsBMP(imageId, @"C:\temp\output.bmp");
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
gdpicturePDF.CloseDocument();
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Load the source PDF document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF.
    gdpicturePDF.SelectPage(1)
    ' Render the selected page to an image.
    Dim imageId As Integer = gdpicturePDF.RenderPageToGdPictureImageEx(200, True)
    ' Save the output in a BMP image.
    gdpictureImaging.SaveAsBMP(imageId, "C:\temp\output.bmp")
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
    gdpicturePDF.CloseDocument()
End Using
End Using
Used Methods

Related Topics

To create an SVG image from a PDF document, follow these steps:

  1. Create a GdPictureDocumentConverter object.

  2. Load the source image by passing its path to the LoadFromFile method. Recommended: Specify the source image format with a member of the DocumentFormat enumeration.

  3. Save the output SVG image by passing its path to the SaveAsSVG method.

The example below creates an SVG image from a PDF document:

using GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter();
// Load the source document.
gdpictureDocumentConverter.LoadFromFile(@"C:\temp\source.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF);
// Save the output in a new SVG image.
gdpictureDocumentConverter.SaveAsSVG(@"C:\temp\output.svg");
Using gdpictureDocumentConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
    ' Load the source document.
    gdpictureDocumentConverter.LoadFromFile("C:\temp\source.pdf", GdPicture14.DocumentFormat.DocumentFormatPDF)
    ' Save the output in a new SVG image.
    gdpictureDocumentConverter.SaveAsSVG("C:\temp\output.svg")
End Using
Used Methods

Related Topics

To convert a page in a PDF document to an image file format not mentioned on the other pages, use the following methods:

Most of these methods take two parameters:

  • The image ID.

  • The path to the output file.

This guide explains how to convert a PDF page to a PBM file.

Converting a PDF Page to PBM

To create a PBM image from a page in a PDF document, follow these steps:

  1. Create a GdPicturePDF object and a GdPictureImaging object.

  2. Load the source document by passing its path to the LoadFromFile method of the GdPicturePDF object.

  3. Select the page that you want to convert to an image with the SelectPage method of the GdPicturePDF object.

  4. Render the selected page to a 200 dots-per-inch (DPI) image with the RenderPageToGdPictureImageEx method of the GdPicturePDF object.

  5. Save the output in a PBM image with the SaveAsPBM method.

The example below creates a PBM image from the first page of a PDF document:

using GdPicturePDF gdpicturePDF = new GdPicturePDF();
using GdPictureImaging gdpictureImaging = new GdPictureImaging();
// Load the source PDF document.
gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Select the first page of the PDF.
gdpicturePDF.SelectPage(1);
// Render the selected page to an image.
int imageId = gdpicturePDF.RenderPageToGdPictureImageEx(200, true);
// Save the output in a PBM image.
gdpictureImaging.SaveAsPBM(imageId, @"C:\temp\output.pbm");
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
gdpicturePDF.CloseDocument();
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
    ' Load the source PDF document.
    gdpicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Select the first page of the PDF.
    gdpicturePDF.SelectPage(1)
    ' Render the selected page to an image.
    Dim imageId As Integer = gdpicturePDF.RenderPageToGdPictureImageEx(200, True)
    ' Save the output in a PBM image.
    gdpictureImaging.SaveAsPBM(imageId, "C:\temp\output.pbm")
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
    gdpicturePDF.CloseDocument()
End Using
End Using
Used Methods

Related Topics