Print PDF from command line in Linux: similar to enscript -2lr
If you're using CUPS printing system, this functionality is included; you won't need any specific tool for that. Just as Theophrastus indicated in a comment, you can use a job option: -o number-up=2
with the CUPS basic printing command lp
or with the BSD-compatibility command lpr
.
If you're using some other printing system that does not include that functionality, you may have to construct a pipeline like this:
pdftops your-PDF-file.pdf | psnup -2 | lp
You may have to add some options to this pipeline to select paper size, printer, etc.
In Debian at least, the pdftops
utility is in poppler-utils
package, and psnup
is in psutils
.
Related videos on Youtube
Harvey King
Updated on September 18, 2022Comments
-
Harvey King over 1 year
I used to print two pages of text on a single side of letter/A4 size paper, each page being a single column on that side.
It was a good balance between readability and saving paper. I was able to do this using a single command:
enscript -2r myTextFile.txt
Is there an modern equivalent, being able to print PDF files in a similar fashion from the command line? When I was using
enscript
, I was using an Apollo workstation :)Thank you in advance!
-
Harvey King over 6 yearsI am using CUPS printing system. Are you saying I can just lp pdf file directly like this: lp -o number-up=2 myPDF.pdf neither lp or lpr man page says anything about be able to print PDF directly... (I guess that reveals how old I really am...)
-
telcoM over 6 yearsUnless you're using a "raw" print queue in CUPS, yes. Modern versions of CUPS are using PDF as an interchange format, i.e. if given a file that cannot be directly fed to the printer (according to its PPD file), it gets first converted to PDF and then to whatever the printer is capable of printing (PS, PCL, PWG Raster or whatever its printing language is). As a result, PDFs are easy for CUPS.