XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
Convert PDF to Png, Gif, Bitmap ... Images
Work with Other SDKs
Convert PDF to Png, Gif, Bitmap ... Images
  |  
Home ›› XDoc.PDF ›› C# PDF: Convert PDF to Png, Gif, Bitmap ... Images

C#.NET PDF SDK - Convert & Render PDF to Images in C#.NET


Online C# Demo Codes for Converting PDF to Raster Images, .NET Graphics, and REImage in C#.NET Project




Best PDF converter SDK for Visual Studio .NET for converting PDF to image in C#.NET application


Free .NET DLLs for converting PDF to images in both .NET WinForms and ASP.NET application


An advanced .NET control able to batch convert PDF documents to image formats in C#.NET


Support exporting PDF to multiple image forms, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Professional .NET library and Visual C# source code for creating high resolution images from PDF in C#.NET class


Create image files including all PDF contents, like watermark and signature in .NET

Turn multipage PDF file into single image files respectively in .NET framework


Converter control easy to create thumbnails from PDF pages


Selection for compressing to multiple image formats


Cut and paste any areas in PDF pages to images


Supports to resize images in conversion


RasterEdge.com provides C# developers with mature PDF document processing and rendering library SDK. Our XDoc.PDF allows C# developers to perform high performance conversions from PDF document to multiple image forms. Besides raster image Jpeg, images forms like Png, Bmp, Gif, .NET Graphics, and REImage (an intermediate class) are also supported. In the following parts, we provide some examples for these PDF conversions.




C#.NET DLLs Solution for Converting Images to PDF in C#.NET



In order to run the sample code, the following steps would be necessary.


Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Raster.dll


  RasterEdge.XDoc.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




C# Sample Code for PDF to Png in C#.NET



You can use this sample code to convert PDF file to Png image.




// Load a PDF file.
String inputFilePath = Program.RootPath + "" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

// Get the first page of PDF file.
PDFPage page = (PDFPage)doc.GetPage(0);

// Convert the first PDF page to a PNG file.
page.ConvertToImage(ImageType.PNG, Program.RootPath + "Output.png");





C# Sample Code for PDF to Bmp in C#.NET



Or use this piece of C# code to implement PDF to Bmp conversion.




// Load a PDF file.
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

// Get the first page of PDF file.
PDFPage page = (PDFPage)doc.GetPage(0);

// Convert the first PDF page to a BMP file.
page.ConvertToImage(ImageType.BMP, Program.RootPath + "\\Output.bmp");





C# Sample Code for PDF to Gif in C#.NET



You can also directly change PDF to Gif image file in C# program.




// Load a PDF file.
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

// Get the first page of PDF file.
PDFPage page = (PDFPage)doc.GetPage(0);

// Convert the first PDF page to a GIF file.
page.ConvertToImage(ImageType.GIF, Program.RootPath + "\\Output.gif");





C# Sample Code for PDF to .NET Bitmap in C#.NET



Moreover, our SDK also allows you to render PDF to .NET Bitmap in C# programming.




// Load a PDF file.
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

// Get the first page of PDF.
PDFPage page = (PDFPage)doc.GetPage(0);

// Render the page to a Bitmap with default setting.
Bitmap bitmap1 = page.GetBitmap();
bitmap1.Save(inputFilePath + "_1.bmp");
//  ...

// Enlarge the page with factor 2.
float zoomRatio = 2.0F;
Bitmap bitmap2 = page.GetBitmap(zoomRatio);
bitmap2.Save(inputFilePath + "_2.bmp");
//  ...

// Render the page with a resolution of 300 dpi.
int targetResolution = 300;
Bitmap bitmap3 = page.GetBitmap(targetResolution);
bitmap3.Save(inputFilePath + "_3.bmp");
//  ...





public override void ConvertToImages(ImageType targetType, String directory, String fileName)

Description:
     Convert all the PDF pages to target format images and output into the directory.

Parameters:




public override void ConvertToImages(ImageType targetType, Stream[] streams)

Description:
     Convert all the PDF pages to target format images and save them into streams.

Parameters:




public override void ConvertToImages(ImageType targetType, float zoomValue, String directory, String fileName)

Description:
     Convert all the PDF pages to target format images and output into the directory.

Parameters:




public override void ConvertToImages(ImageType targetType, float zoomValue, Stream[] streams)

Description:
     Convert all the PDF pages to target format images and save them into streams.

Parameters:




public override void ConvertToImages(ImageType targetType, int resolution, String directory, String fileName)

Description:
     Convert all the PDF pages to target format images and output into the directory.

Parameters:




public override void ConvertToImages(ImageType targetType, int resolution, Stream[] streams)

Description:
     Convert all the PDF pages to target format images and save them into streams.

Parameters:




public override void ConvertToImages(ImageType targetType, ImageOutputOption option, String directory, String fileName)

Description:
     Convert all the PDF pages to target format images and output into the directory.

Parameters:




public override void ConvertToImages(ImageType targetType, ImageOutputOption option, Stream[] streams)

Description:
     Convert all the PDF pages to target format images and save them into streams.

Parameters: