Q: One of the features that I need is the ability to set the document
to Duplex printing.
This is a feature only recently available (I think in Adobe 7 or 8).
Is PDFNet SDK capable of setting this attribute in a PDF document that
it creates?
How about some other properties such as "PrintScaling", "PrintArea",
or "PickTrayByPDFSize"? Thank you.
-----
A: Using the existing API it is also very simple to set values for
Duplex, PrintScaling etc. For example:
// C# (C++/Java is the same - apart from minor syntax differences).
-------------------
static void SetDuplex(PDFDoc doc, string mode) {
Obj vprefs = doc.GetRoot().FindObj("ViewerPreferences");
if (vprefs == null) vprefs = doc.GetRoot().PutDict("Duplex");
vprefs.PutName("Duplex", mode);
}
static void SetPrintScaling(PDFDoc doc, string mode) {
Obj vprefs = doc.GetRoot().FindObj("ViewerPreferences");
if (vprefs == null) vprefs =
doc.GetRoot().PutDict("ViewerPreferences");
vprefs.PutName("PrintScaling", mode);
}
-------------------
Sample use cases:
SetDuplex (pdfdoc, "Simplex"); // Print single-sided
SetDuplex (pdfdoc, "DuplexFlipShortEdge"); // Duplex and flip on the
short edge of the sheet
SetDuplex (pdfdoc, "DuplexFlipLongEdge"); // Duplex and flip on the
long edge of the sheet
SetPrintScaling(pdfdoc, "AppDefault");
SetPrintScaling(pdfdoc, "None");
----
Also, we will most likely extend pdftron.PDF.PDFDocViewPrefs class
with the above helper functions to set the 'Duplex' mode and other new
preferences.