I am generating a PDF by PHP with FPDF. This works well.
Now what I want:
From a multipage PDF all pages expect the last one have to print with paper from tray1 and the last page from tray2.
Now the Question:
How is this possible? Is this a Acrobat Reader issue? Can it be done with JavaScript in PDF?
In the Page Setup window click on the Paper tab. Select the intended tray for the first page and remaining pages. Make sure that the same tray is selected in the Driver Properties. The job will now print to the intended tray.
It is not possible, as PDFs do not contain any information on the printer trays or other information. It is actually set in the printer instructions through the client's printer driver, who has to provide this information to the client program. If you need this functionality for batch processing, you'd have to leave PHP and get on the client side, e.g. through the Acrobat SDK, in which you can give this information, e.g. on a PostScript printer via the SetPageDevice-function
I use CUPS on an intranet website. I don't specify a tray and my code is ruby, but the principle definitely works.
Here's my code, see if you can adapt it for your scenario
def print(path)
raise ArgumentError, "'#{path}' does not exist" unless File.file?(path)
`lp -s -d printer_name -h 127.0.0.1 -o page-ranges=1-4 -o media=A4,Upper #{path}`
$?.to_i == 0 ? true : false
end
The basic idea is to generate the PDF, save it to disk then call this method to shell out to CUPS. You might need to play with the media option to get it doing what you need. 'Upper' is the tray you're targeting.
Make sure path is sanitised before being passed to this method or you risk opening a security hole.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With