Q: We want to print PDFs without having to use acrobat to automate the
process. Acrobat is displayed as a popup and does not always go
away. Plus it just looks clunky and is against Acrobat's license.
So I downloaded your PDFView sample from http://www.pdftron.com/net/samplecode.html
and it printed our documents perfectly. However when I look at the C#
code link that you have, I do not see the print functionality.
In addition when I look at the PDFPrint C# sample code and run it, it
does NOT render the document appropriately. There are sizing issues
and some parts are cut off. I modified the SetRasterType as document
in the sample code and also toggled the use_hard_margins feature to no
avail
-----
A: For the sample code, please refer to the code in the 'PDFNet/
Samples' folder that comes as part of the production SDK. The sample
code on the web site is used only for browsing (it does not include
all of the required files and is possibility out of date).
Regarding PDFPrint sample project there are couple of things to note:
- If the PDF page does not print properly it, means that PDFNet can't
find 'pdfnet.res' and that PDFNet.SetResourcesPath() returns false. To
resolve this problem, simply make sure that correct path is passed in
SetResourcesPath(). For more information, please see
http://www.pdftron.com/net/faq.html#pdfnet_res.
- If the print margins are not correct you may need to use different
margins (e.g. obtained using Win32 or .NET Framework API). PDFNet
offers a single method called PDFDraw.DrawInRect(...) that render the
PDF page within the given rectangle. By shifting around the rectangle
passed as a parameter in DrawInRect() you will be able to render the
PDF at the arbitrary location.