开发者

How can I select papertray

How do I programatically select the papertray to use when I send a document to the printer? There is different papers开发者_Python百科 in the trays (A5, A4, A4 with one tear off part or two tear off parts, Papers with logo and without logo).

Today we use the setpapertray command directly in the postscript-file, but this is not very convenient especially since we plan to move to producing pdf-files instead.

Any suggestions?

EDIT: Today we send the ps-documents directly to the printer with commands like

cat file.ps > /dev/usb/lp0

or in programs just by opening the device and writing to it.

So since we use postscript templates its easy to select the tray to use directly by putting a section like this in the template:

statusdict begin
/manualfeed false def
$paper_tray setpapertray
end

Now we want to get rid of the ps-templates since they are hard to work with, and its not always safe to assume the printer is directly connected but could be at a external printerserver.

Questions:

  • Is it possible to embed the tray selection in a pdf-file in the same way?
  • Is there another more convenient way to select tray for each document when printing multiple documents?


You can print PDF and PostScript files from the command line using cups, ie:

lp filename.pdf

You can pass options on the command line using the -o option, ie

lp -o media=A4 filename.pdf

If your printer supports trays then you can probably use something like this:

lp -o InputSlot=Tray2

You can list all the options for the -o switch:

lpoptions -l

See http://www.cups.org/documentation.php/options.html#OPTIONS for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜