Convert PDF to other images in C#
PDF to Other Image
     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 the steps below:
- Create a 
GdPicturePDFobject and aGdPictureImagingobject. - Load the source document by passing its path to the 
LoadFromFilemethod of theGdPicturePDFobject. - Select the page that you want to convert to an image with the 
SelectPagemethod of theGdPicturePDFobject. - Render the selected page to a 200 dots-per-inch (DPI) image with the 
RenderPageToGdPictureImageExmethod of theGdPicturePDFobject. - Save the output in a PBM image with the 
SaveAsPBMmethod. 
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 UsingEnd UsingRelated topics