For future readers of this post, if the commercial library is an acceptable choice, you can do this using Amyuni PDF Creator ActiveX (Delphi, C ++, VB, PHP) or Amyuni PDF Creator. Net (C #, VB.net, etc.) by Changing the "PaperBin" property of the object.
Possible values โโof this property can be found in the documentation for the DEVMODE structure on MSDN , examples: DMBIN_UPPER - 0x0001, DMBIN_LOWER - 0x0002, DMBIN_AUTO - 0x0007.
The code in C # will look like this:
Amyuni.PDFCreator.IacDocument pdfDoc = new Amyuni.PDFCreator.IacDocument(); using(FileStream fs = File.Open("MyDocument.pdf", FileMode.Open)) { pdfDoc.Open(fs, ""); } const int DMBIN_MANUAL = 4; for( int pageNumber = 1; i <= pdfDoc.PageCount; i++) { pdfDoc.GetPage(pageNumber).AttributeByName("PaperBin").Value = DMBIN_MANUAL; } pdfDoc.Print("My Laser Printer", False);
For PHP, you will need to use the ActiveX version and create the document using the ProgID of the ActiveX control:
$pdfdoc = new COM("PDFCreactiveX.PDFCreactiveX");
Please note that this approach applies to printing on a specific tray using the library, as mentioned in other answers, it is not possible to save this information in the PDF file itself so that it can be used by other applications.
Disclaimer: I currently work at Amyuni Technologies.
source share