Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144277 | Apr 28,2019 10:07 AM UTC | May 2,2019 12:01 PM UTC | WinForms | 4 |
![]() |
Tags: PdfViewer |
// 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); |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.