Output Image Size
ImageSize specifies the height, width, horizontal resolution and vertical resolution of the generated image. Several static ImageSizes are defined for quick use. These static ImageSizes and their defined values are as follows:
cete.dynamicpdf.rasterizer.imagesize.dpi150
- Horizontal DPI (Dots Per Inch): 150
- Vertical DPI: 150
ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi300
- Horizontal DPI: 300
- Vertical DPI: 300
ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi600
- Horizontal DPI: 600
- Vertical DPI: 600
ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi72
- Horizontal DPI: 72
- Vertical DPI: 72
ceTe.DynamicPDF.Rasterizer.ImageSize.Dpi96
- Horizontal DPI: 96
- Vertical DPI: 96
ceTe.DynamicPDF.Rasterizer.ImageSize.FaxStandard
- Horizontal DPI: 204
- Vertical DPI: 98
ceTe.DynamicPDF.Rasterizer.ImageSize.FaxFine
- Horizontal DPI: 204
- Vertical DPI: 196
ceTe.DynamicPDF.Rasterizer.ImageSize.FaxSuperfine
- Horizontal DPI: 200
- Vertical DPI: 400
The below example illustrates the syntax that would be needed to rasterize a PDF document into a JPEG image using a static ImageSize.
PdfRasterizer rasterizer = new PdfRasterizer("C:\\DocumentA.pdf");
rasterizer.Draw("C:\\DocumentA_Page.jpg", ImageFormat.Jpeg, ImageSize.Dpi150);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer("C:\DocumentA.pdf")
MyRasterizer.Draw("C:\DocumentA_Page.jpg", ImageFormat.Jpeg, ImageSize.Dpi150)
Alternatively to using one of the above static image sizes you can just instantiate any object that inherits from the ImageSize object and use that as one of the arguments to pass into the PdfRasterizer's Draw method. These ImageSize objects and there uses are as follows:
- ceTe.DynamicPDF.Rasterizer.DpiImageSize - Allows any horizontal and vertical DPI (Dots Per Inch) to be defined for the output image.
- ceTe.DynamicPDF.Rasterizer.FixedImageSize - Allows any height and width to be defined for the output image.
- ceTe.DynamicPDF.Rasterizer.MaxImageSize - Allows any height and width to be defined for the output image but MaxImageSize will only output the final image as big as you have defined while still maintaining the original document proportions.
- ceTe.DynamicPDF.Rasterizer.PercentageImageSize - Allows any horizontal or vertical percentage (of the original document) to be defined for the output image.
The below example illustrates the syntax that would be needed to rasterize a PDF document into a JPEG that is exactly 200 points in height and 200 points in width.
PdfRasterizer rasterizer = new PdfRasterizer("C:\\DocumentA.pdf");
FixedImageSize jpegSize = new FixedImageSize(200, 200);
rasterizer.Draw("C:\\DocumentA_Fixed200_Page.jpg", ImageFormat.Jpeg, jpegSize);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer("C:\DocumentA.pdf")
Dim MyJpegSize As FixedImageSize = New FixedImageSize(200, 200)
MyRasterizer.Draw("C:\DocumentA_Fixed200_Page.jpg", ImageFormat.Jpeg, MyJpegSize)