Crop and Rasterize

This example illustrates using the System.Drawing.Rectangle object to define a region on a PDF page for subsequent cropping and rasterization.

PdfRasterizer rasterizer = new PdfRasterizer(pdfFilePath);            
for (int i = 0; i < rasterizer.Pages.Count; i++)
     System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(new System.Drawing.Point(50, 50), new System.Drawing.Size(200, 200));
     rasterizer.Pages[i].Draw(pngFilePath, ImageFormat.Png, ImageSize.Dpi72, rectangle);
Dim rasterizer As PdfRasterizer = New PdfRasterizer(pdfFilePath)
For i As Integer = 0 To rasterizer.Pages.Count -1
     Dim rectangle As System.Drawing.Rectangle = New System.Drawing.Rectangle(New System.Drawing.Point(50, 50), New System.Drawing.Size(200, 200))
     rasterizer.Pages(i).Draw(pngFilePath, ImageFormat.Png, ImageSize.Dpi72, rectangle)

In this topic