)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to "Take a snapshot" as on Acrobat?

Platform: WinForms |
Control: PdfViewer |
Published Date: November 12, 2014 |
Last Revised Date: October 6, 2020

We can perform this action from our code behind.

Below is the code snippet to select a particular region and return it as an image that we need to do in the Form.cs

C#

private void Form1_Load(object sender, EventArgs e)
{    
    // Create an instance PdfDocumentView
    PdfDocumentView view = new PdfDocumentView();
 
    // Load the document to be exported as image
    documentView.Load("../../Data/PDF_Succinctly.pdf"); 
 
    // ExportAsImage return the bitmap image of any page of the loaded pdf document
    Bitmap image = documentView.ExportAsImage(0);
 
    // Select a region to take snapshot 
    Rectangle newRect = new Rectangle(150, 100, 400, 400);
 
    // Use Bitmap.Clone( ) to  save the image in local drive
    System.Drawing.Imaging.PixelFormat format = image.PixelFormat;
    Bitmap cloneBitmap = image.Clone(newRect, format);
    cloneBitmap.Save("PDF_Succinctly.png");    
}
 

 

Sample:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample2116766911

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon