0

I have 50+ documents to print with the exact same printer settings and I'm trying to batch print them using the existing printer preset. What I've done so far:

  • open all documents in one preview windows on El Capitan -> doesn't work, prints all documents as one document instead of separate ones (e.g. if the documents have an odd number of pages, the next documents is printed on the back of the last page)
  • Try a python script to create a pdf made of all my needed documents in the right format, so that I could print it and separate the documents manually -> unsucessfull as my python skills are not that great + needs to be done again everytime the situation happens again.
  • change the cups settings and hit cmd+P in the finder -> doesn't work as I can't get the right margin settings in CUPS + the solution is not a long term one as one would need to tinker with CUPS every time a new batch job with different settings has to be done, eventually loosing the overview of what has changed.

In short, I would need the preview printing dialog batch applying to a bunch of documents or an applescript/automator etc. that can use existing printer preset (those must be stored somewhere in the system, I don't know where) and apply it to selected documents. Any idea?

System: 10.14 but I can use 10.11 if needed.

6
  • Would printing from the command line be an option (see localhost:631/help/options.html or man lpr/man lpoptions)?
    – nohillside
    Jun 19, 2020 at 12:05
  • didn't know that command. I'll try it and document my experience, thank you!
    – almerillat
    Jun 19, 2020 at 12:08
  • Are the documents already PDFs, or some other format? Or bunch of formats? I have produced a range of python scripts (that can be used in Automator Actions for ease) that combine images into PDFs, merge PDFs, which may be of help. github.com/benwiggy/PDFsuite
    – benwiggy
    Jun 19, 2020 at 12:18
  • Also, could you let us know exactly what (kind of) print settings you're wanting to set, and even what printer? E.g. is it something like paper size and page range, or more device-specific stuff.
    – benwiggy
    Jun 19, 2020 at 12:45
  • @benwiggy In my case PDFs in A4 duplex on long edge, 3x printed with margins of 1 cm on top and bottom (the CUPS default uses a 1.5 cm margin and doesn't print the 0.5 cm of my document that is outside of bound; I couldn't change that). The printer is an HP Color LaserJet M750 accessed over the network/bonjour. That beeing said, I'm looking for a more general answer that could fit a wider range of needs (and would be useful for other users as well). Hence why I formulated my question broadely.
    – almerillat
    Jun 19, 2020 at 12:56

3 Answers 3

4

So based on previous comments and answers I settled for a bash script with a for loop:

#! /bin/bash

cd /path/to/your/PDFfiles
for pdffile in *.pdf; do
        lpr -P MY_PRINTER -o media=A4 -o sides=two-sided-long-edge -o InputSlot=tray-3 "$pdffile";
done

Beware that this script prints all pdfs in /path/to/your/PDFfiles ! A few useful commands to tailor this script to your needs:

  • lpstat -p lists all printers in your system and gets you the "CUPS name" (I guess it's called so?) of your printer
  • lpoptions -p MY_PRINTER -l lists the printer-specific options you can add with the -o option=xy option of the lpr command. The generic CUPS options (= for ± all compatible printers) are visible at https://www.cups.org/doc/options.html#OPTIONS

If you want so save this script: save it as batchprint.sh, make it executable with chmod a+x batchprint.sh and next time you drag and drop this script to a terminal window, it will do what you whish!

1
  • 1
    Awesome, thanks for coming back and documenting your solution!
    – nohillside
    Jun 22, 2020 at 7:30
2

When you use Command P in the Finder, an image or PDF file will print using the default preset. You can configure a Print Preset as the default by saving it, then select it and hold Option when you click on Print.

In System Preferences > Printers, you can click on "Open Print Queue", and then you can drop files directly onto the Printer's queue window. This include PDFs but also other image formats natively handled by MacOS.

So the trick is configuring the print queue with the settings you want, which you can do from the CUPS web interface. You can then create as many print queues with different characteristics as you like. However, you seem to suggest that's not working for you.

You could also use the lp or lpr shell commands, with whatever options for your printer that you require. See the CUPS manual for details.

In AppleScript, it is possible to print with properties, but those don't seem to include device-specific options, nor presets.

3
  • I can't set the default preset with the option key (neither on mojave nor on el cap'). Printing with cmd+P from the finder seems to use the default CUPS settings. All the information I could find online about this trick relates to older version of OS X. Could it be that this feature is no more available in newer OS versions?
    – almerillat
    Jun 19, 2020 at 12:48
  • I am using Mojave and Option-Print sets the current Preset as the default. (Note: it doesn't change the values in the preset named "Default".) It's been like that since Classic Mac.
    – benwiggy
    Jun 19, 2020 at 12:50
  • Definitely doesn't work on my setup unfortunately, at least the way I did it: 1. set up preset and save it (test preset: booklet) 2. open the print dialog with cmd+P and pressing the option key when clicking on print (prints a first document) 3. select a document in finder and hit cmd+P (prints a second document) --> with that the second document is printed with default CUPS settings and not with the should-be default preset. I thought my system might be broken, but what bothers me is that both my desktop and laptop don't show the expected behaviour... Or am I doing something wrong?
    – almerillat
    Jun 19, 2020 at 13:21
2

There are a couple of things you can do:

  • Printer Presets

    Under the Presets menu, see if the Reset Presets Menu to “Default Settings” is checked. If this is checked, uncheck it and the last preset you used remain in place when you finish printing the document.

  • Create a "New" Printer

    Create a new printer that prints to the same device, but set all the printer defaults (printer presets) the way you like them. When you print, print to that printer instead. You can even temporarily set that printer as the "default printer." Just remember to set it back when you're done.

You must log in to answer this question.

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