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.









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