I often upload some pdf files on a server to print them at my faculty. On the server I follow these steps:
1. Convert the uploaded pdf files to postscript
for file in `ls -1`; do pdftops $file; done
ls -11 lists all the files of the current directory, one file per line. pdftops actually converts the pdf files to postscript.
2. Delete the pdf files
rm *.pdf
We need to delete the pdf files to only list postscript files in the next command.
3. Put two pages on one page and print them
for file in `ls -1`; do psnup -2 -d0 $file | lpr -Pscit32411d; done
Again we walk through the file list but this time psnup prints two pages on one page and we pipe its result to the print command lpr. The argument P is the printer name of our destination.
I’m sure this can be done in only one line but I’m not a big shell scripter so I make the batch printing in three lines.
- The parameter is a one and not a l ↩