Output Image Size

DynamicPDF Rasterizer for .NET provides both a static ImageSize class for easily creating images from PDFs and several classes that extend ImageSize that supports creating images with custom sizing.

Static ImageSize

DynamicPDF Rasterizer for .NET provides an ImageSize class which specifies the height, width, horizontal resolution and vertical resolution of a generated image. DynamicPDF Rasterizer defines the following static ImageSize classes for quick use in your applications.

Use an ImageSize subclass with the Draw method, described below, to create custom sized images.

ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi150

ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi300

ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi600

ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi72

ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi96

ceTe.DynamicPDF.Rasterizer.ImageSize.FaxStandard

ceTe.DynamicPDF.Rasterizer.ImageSize.FaxFine

ceTe.DynamicPDF.Rasterizer.ImageSize.FaxSuperfine

The following example illustrates rasterizing a PDF document into a JPEG image using a static ImageSize.

PdfRasterizer rasterizer = new PdfRasterizer(pdfFilePath);
rasterizer.Draw(pngFilePath, ImageFormat.Jpeg, ImageSize.Dpi150);       
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer(pdfFilePath)
MyRasterizer.Draw(pngFilePath, ImageFormat.Jpeg, ImageSize.Dpi150) 

ImageSize Using Draw Method

Rather than using a static image size, you can use one of the classes that inherit from the ImageSize class.

Pass one of the listed subclasses into the PdfRasterizer class's Draw method to create the custom-sized image. The following example illustrates rasterizing a PDF document into a JPEG that is 200 points in height and 200 points in width.

PdfRasterizer rasterizer = new PdfRasterizer(pdfFilePath);
FixedImageSize jpegSize = new FixedImageSize(200, 200);
rasterizer.Draw(pngFilePath, ImageFormat.Jpeg, jpegSize);       
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer(pdfFilePath)
Dim MyJpegSize As FixedImageSize = New FixedImageSize(200, 200)
MyRasterizer.Draw(pngFilePath, ImageFormat.Jpeg, MyJpegSize)

In this topic