How can I change the paper size and paper orientation when generating PDF using PDFDCEX?

75 views
Skip to first unread message

Support

unread,
May 20, 2011, 4:51:07 PM5/20/11
to PDFTron PDFNet SDK
Q: In your PDFDC (PDF Device Context) example, how can I change the
paper size and orientation in the 'pdftron.PDF.PDFDCEX' part of the
example?

Normally, we use CreateDC with a DevMode specifying the size and
orientation. How can I accomplish the same thing with PDFDCEX?

-----------------------

A: There is no way to set the bounding box ahead of time however you
can modify the page boxes (page.SetCropBox()/SetMediaBox()/
SetRotation()) after the page is created. You could use
page.GetBoundingBox() to determine the extents of the content area -
in case you would like to adjust the page rectangle based on the
content.

Ryan

unread,
Dec 10, 2014, 7:43:34 PM12/10/14
to pdfne...@googlegroups.com
The latest PDFNet releases now have the option to set the page dimension in the PDFDCEX class (not PDFDC though).

The PDFDCEX.Begin() method can now take in a pdftron.PDF.Point object, where x=width and y=height of the page in inches.

Note we no longer advise the PDFDC interface, as it is easy to replace with the more powerful PDFDCEX, which now includes the above option.
Reply all
Reply to author
Forward
0 new messages