// ExportAsImage return the bitmap image of any page of the loaded pdf document
Bitmap image = pdfDocumentView.ExportAsImage(m_printToPage);
// Select a region to take snapshot
Rectangle newRect = new Rectangle(150, 100, image.Width / 2, image.Height / 2);
// Use Bitmap.Clone( ) to save the image in local drive
System.Drawing.Imaging.PixelFormat format = image.PixelFormat;
Bitmap cloneBitmap = image.Clone(newRect, format);
|
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += PrintDocument_PrintPage;
private void PrintDocument_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(cloneBitmap,0,0); } |
PdfDocumentView viewer = new PdfDocumentView();
viewer.Load(pdf_file_path);
// Get the page count
Int totalPages = viewer.PageCount; |
// Exports the specified page as Image with respect to dpi specified.
Bitmap image = pdfViewerControl.ExportAsImage(m_printToPage,500,500); |