Because I don't want to give any information about a corporate printer to CUPS, because I suspect it trying to access it even when I'm not on the corporate network, I use the following "script" to print documents on a corporate printer managed by a Windows print server:
smbclient "//printserv.acme.corp/BUILDING0PRINTER1" "password" -c "print /tmp/my.pdf" -U "username" -W "Domain"
The printer is some HP MFP and can very well print duplex. My command, however, does not print duplex.
My question is: How to print a PDF in duplex mode (such that both sides of the paper sheet are used, aka flip on long edge)?
I don't mind extending my "script" by prepending some weird PCL or Postscript commands, but I don't want CUPS to be searching for the printer (and potentially send my password into the ether).
I found that pdftops
provides a -duplex
switch.
So I scripted the following:
pdftops -paper A4 -duplex "$1" "${1}.ps"
smbclient "//printserv.acme.corp/BUILDING0PRINTER1" "password" -c "print \"${1}.ps\"" -U "username" -W "Domain"