For future readers of this post, if a commercial library is a valid choice then it is possible to do this with Amyuni PDF Creator ActiveX (Delphi, C++, VB, PHP) or with Amyuni PDF Creator .Net (C#, VB.net, etc.) by changing the "PaperBin" property of a page object.
Possible values for this property can be found in the documentation for the DEVMODE structure in MSDN, examples: DMBIN_UPPER - 0x0001, DMBIN_LOWER - 0x0002, DMBIN_AUTO - 0x0007.
The code in C# would 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");
Note that this approach is about printing to a specific tray using the library, as other answers have mentioned, it is not possible to store this information in the PDF file itself so that it can be used by other applications.
Disclaimer: I currently work for Amyuni Technologies.