Skip to main content

Output Image Format

Version: 1.0

Output Image Format

Defining the ImageFormat is what allows you to define the type of image that will be output and what options to use with that output image. Several static ImageFormats are defined for quick use. Using these static members can simplify your code significantly when image output types do not need a lot of customization. These static ImageFormats are as follows:

Alternatively you can just instantiate the ImageFormat type that you need to use and set up it's properties directly. In this case you will want to instantiate one of the following objects to pass into the PdfRasterizer's Draw method:

One example of this is demonstrated below. This sample illustrates the syntax that would be needed to rasterize a PDF document into a PNG with transparency. 

PdfRasterizer rasterizer = new PdfRasterizer("C:\\DocumentA.pdf");
PngImageFormat png = new PngImageFormat(PngColorFormat.RgbA);
rasterizer.Draw("C:\\DocumentA_Transparent_Page.png", png, ImageSize.Dpi72);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer("C:\DocumentA.pdf
Dim MyPng As PngImageFormat = New PngImageFormat(PngColorFormat.RgbA)
MyRasterizer.Draw("C:\Temp\Document_Transparent_Page.png", MyPng, ImageSize.Dpi72)
Documentation version