How to print multiple files?

James Gray james at gray.net.au
Tue Jun 17 06:21:30 UTC 2008


On 17/06/2008, at 8:32 AM, Dotan Cohen wrote:

> How can one select many (~20) PDF files and have them all print?
> Additionally I'd like to configure them to print two pages per sheet,
> if that is possible. Thanks.

Certainly is possible :)  Install the package "psutils" and assuming  
you have ghostscript installed, you can do this from the command line:

for PDF in *.pdf
do
pdf2ps $PDF - | psnup -2 | lp
done

That will find every PDF file in the current directory, convert the  
PDF to Postscript, dump the result into "psnup" which will mash the  
postscript into a "2-up" format, then finally hand the PostScript to  
the default printer via "lp".  You may also replace "| lp" with ">  
`basename $PDF .pdf`-2up.ps" (without the "") to create a Postscript  
file in 2-up format for each PDF.

If you'd prefer 4-up, replace "psnup -2" with "psnup -4".  Similarly,  
if your printer can do duplex (double sided printing) you can tell it  
to print both sides with "lp -o sides=two-sided-short-edge" instead of  
plain old "lp".  If you'd prefer the 2-up converted documents back in  
PDF format:

for DOC in *-2up.ps
do
ps2pdf $DOC `basename $DOC .ps`
done

HTH,

James




More information about the kubuntu-users mailing list