PDF duplex/simplex/tray-switching

Q: Do you have a solution by your PDF SDK/API for the PDF pages to be
printed with duplex/simplex/tray-switching control dynamically?
-----
A: You can set the setting for 'Duplex' property in PDF document as
follows (this is feature along with 'PrintScaling', 'PrintArea', or
'PickTrayByPDFSize' was added only in Acrobat 8):

// Utility C# Functions: (VB/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
("ViewerPreferences");
  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:

// Print single-sided
SetDuplex (pdfdoc, "Simplex");

// Duplex and flip on the short edge of the sheet
SetDuplex (pdfdoc, "DuplexFlipShortEdge");

// Duplex and flip on the long edge of the sheet
SetDuplex (pdfdoc, "DuplexFlipLongEdge");

...

SetPrintScaling(pdfdoc, "AppDefault");
SetPrintScaling(pdfdoc, "None");

----

If you would like to programmatically select paper tray and other
properties during printing, instead of setting 'Duplex' property
within a PDF document, than you would need to use platform specific
calls to configure the printer. PDFNet simply accepts a preconfigured
printer DC (Device Context/Graphics object passed in pdfdraw.DrawInRect
()) and it does not deal with printer specific configuration.

For example, if you are developing under .NET you would check for
related .NET Framework API usage (in MSDN). In this case you can
choose a specific printer by setting PrinterName property under
PrintDocument.PrinterSettings.
For example, ...
Dim printer As New PrintDocument
printer.PrinterSettings.PrinterName = "\\Bhsf-JoeDoe\Dell Laser
Printer P1500 PS3"
...

Similarly, you can set Duplex and other properties using
PrinterSettings in the PrintDocument. For example:
printer.PrinterSettings.Duplex=DuplexMode;