Batch print PDFs

Anyone have any tips for batch printing? Specifically, I’m a teacher and I’d like to use the staple feature of a printer at work to print each file (reports for graduating students) as a stapled set of pages.

I’ve tried configuring printer options and saving a preset (even setting as default with Option + Print) but dragging the files into the print queue window - which works fine with default settings - doesn’t use my preset or prompt for options. This feels like a bug and I plan to file a feedback.

I did begin to dive into configuring CUPS via localhost:631 but none of the options in that interface put the staple in the correct position! I haven’t tried with lpr but would expect the same issue.

For this round, I just did ~200 manually using the preset but I would be very interested in ideas to try next time!

Filed as FB13459461.

If your printer supports some stapling lpr option, you can use a shell script with the proper options set.

To see whether the printer supports stapling, type the following command in the terminal - it lists all printer options that are accessible through lpr:

lpoptions | tr \  \\n

(the | tr .... part makes the output easier to read).

If you see a stapling option there, you can use lpr in a shell script that would loop through all your files and print them.

A sample script for printing all the files in a folder (note: you’ll need to add a -o staple=true or the like, depends on your printer):

#! /bin/bash

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

(script taken from pdf - Batch print with printer preset in MacOS - Ask Different)

1 Like

Thanks. I explored that when configuring CUPS to set the default for the queue window (the options for CUPS and lpr both come from the PPD?). The staple options didn’t match the regular interface and the ones I tried stapled the pages upside down. I abandoned it because I didn’t want to waste any more paper or time (next step would be to flip the documents first or before piping to lpr?).

You should be able to set the orientation through lpr as well, so you can add this to your existing stapling setup and maybe this will solve the upside-down stapling problem:

lpr -o orientation-requested=N

There are a few options for N. See Command-Line Printing and Options and scroll down to " Setting the Orientation".

1 Like