How do I print a specific region of a PDF page?

56 views
Skip to first unread message

Support

unread,
Mar 28, 2013, 1:40:32 PM3/28/13
to pdfne...@googlegroups.com
Q:
 
One of my requirements is to provide the ability to print a region of a PDF file.

Does PDFNet support printing a region of a PDF file, by using the rectangle tool to select the region? Is there a sample, preferably in VB.NET?

-------------
A:

Yes, this is possible. 

As a starting point please take a look at PDFPrint sample (http://www.pdftron.com/pdfnet/samplecode.html#PDFPrint) that comes as part of the SDK. 

The sample shows two ways to print a PDF … using PDFDraw and using pdftron.PDF.Print.StartPrintJob(). 

To print a subset of a PDF page you can adjust the crop box on a page using page.SetCropBox(rect) just before printing. 

In case you also need to build interactive app to let user define the crop areas interactively please take a look at PDFView sample project (both C# and VB.NET versions are available). Specifically, take a look at ‘MyPDFView.cs’ which shows how to extend the control and how to implement some custom tools (e.g. link tool). This code could be easily repurposed for your needs.
 


 
Reply all
Reply to author
Forward
0 new messages