17

Say I start off from a PDF document, say of 12 pages, viewed with evince. To produce another PDF of 6 sheets, with a page setup of two pages per side, I normally use the "Print to File" device listed in the ^P dialogue window. This works out pretty neatly.

I would like to translate this operation for the command line.

  • To my understanding, this is not an operation that pdftk can do. Please cross check.
  • The command lp, which would accept the option -o number-up=2, does not recognize any device called "Print to File", which indeed does not show up in lpstat -p -d.
  • I am aware of the post What is “Print to File” and can it be used from command line?. I have installed cups-pdf whereby a new printer named PDF is acknowledged. However, the print quality of a simple text file is way too raw (for example, no print margins to start with). Moreover, if I reprint an existing PDF file on this device, say lp -p PDF existing.pdf, evince can't even manage to open that copycatted output, while this is not the case with the "Print to File" way.
  • I had a look at man evince. At the bottom, it touches upon a few print preview options and redirects to a GNOME-developer project page. Admittedly I am not able to make sense and use of it.

Is there actually a way to combine the flexibility of the command line with the print quality that I obtain from that "Print to File" option in the GUI evince?

My test case, again, would be to create from the command line a PDF out of a source document printed with two pages per sheet.

Thanks for thinking along.

4 Answers 4

18

There is the pdfnup (or pdfjam) command line tool. You can install it from the repositories of your distribution (sudo apt-get install pdfjam for Debian-based distributions, yaourt -S pdfnup on Arch etc).

The default options will take the input PDF file and produce an output PDF with two input pages per page:

pdfnup -o output.pdf input.pdf
4
7

To expand on the accepted answer:

Using pdfjam you will need to pass the landscape option as well. The usage is:

pdfjam input.pdf -o output.pdf --nup 2x1 --landscape

Note that the extra --angle 90 might save your day, depending on the orientation of the pages in the original PDF.

1

Yes you can print multiple pages:

command | lpr -P <printername> -p <priority from 1 to 100>

Example of use:

ls -l | lpr -P hpprinter -p 2
1
  • 1
    Hi. This answer bumps against the limitation that, if I launch lpr -P PDF -p 2 the quality of the result is way too raw. It is useful if that is not a requirement. Commented Jan 10, 2016 at 12:45
1

To expand on this extended answer for non-Americans using ISO A4:

pdfjam input.pdf -o output.pdf --nup 2x1 --landscape --paper a4paper

Otherwise pdfjam seems to default to US-Letter (at least on my machine).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .