I have a system that generates PDFs in an assortment of layouts, then sends them to a printer. I've been doing this exactly the same way religiously¹ for 3 years. The process is scripted and the scripts are under version control.
Two computers are involved, one local that commits the source files to a repository and pushes them to a remote build server where the PDFs are generated. The output is synced back to the local machine where another script sends them to the printer. The script that sends them to the printer sends odd and even pages separately and waits for user input to confirm that the paper has been flipped.
The commands run look something like this (I only changed the normal print runs of 75 to 2 and stripped the full path):
# Print 2 of 20170205 in cemaat-sozlu format? (y/n) y lpr -#2 -o Collate=True -o page-set=even -o outputorder=reverse 20170205-cemaat-sozlu.pdf # Page successfully flipped? (y/n) y lpr -#2 -o Collate=True -o page-set=odd 20170205-cemaat-sozlu.pdf
About 2 months ago all the duplex formats started coming out with blank pages before each set. For example printing 2 copies of a 4 page PDF which should print pages
4 2 4 2, prompt for a flip, then print
1 3 1 3 started coming out with
b 4 2 b 4 2. Strangely enough the odd page run did not spit out blanks.
Note there are no blanks in the generated PDFs and as far as I can tell the build system is not suspect as it did not receive any updates at this time and as far as I can tell the problem is not with the source PDFs.
I started fiddling with the CUPS printer configuration. No settings seemed relevant at all, but as there are a couple of driver options, I decided to play with that.
HP LaserJet m1522 MFP Series Postscript
This is the driver I had been using, is the one marked "(recommended)" by CUPS, but that started giving me blanks.
HP LaserJet m1522nf MFP Foomatic/Postscript
This driver works, but page alignment is all out of whack and it gave me blanks on both odd and even print runs (
b 4 2 4 2then
b 1 3 b 1 3).
HP LaserJet m1522nf MFP Foomatic/pxlmono
This driver gives me garbage.
HP LaserJet m1522nf MFP pcl3, hpcups
This driver seems to behave roughly the same as the first one except that printing takes forever. I don't think it likes the raster data of page 1 of each PDF and it stops for about 30 seconds in between each set of pages to spool.
HP LaserJet m1522nf MFP hpijs pcl3, 3.16.10
This driver works alright speed wise, and better than the default one in the blanks department. The 4 page sets print fine with no blanks, but the 6 page sets still have blanks (again only on the first pass:
b 6 4 2 b 6 4 2then
1 3 5 1 3 5)
Both systems are running Arch Linux. The one doing the printing does get frequent updates and probably got an updated version of something printing related before this started happening. It certainly did a couple weeks after that because I was looking out for cups related packages. I've tested this after the second set of updates but there was no change.
Note I've tried printing from
evince, both of which work fine as far as duplexing goes but are not scriptable and have other issues such as page scaling and color rendition issues that just feeding the PDFs to
lpr does not have.
lpr doesn't seem to have this issue with any non-duplexed print jobs.
Did something change in
lpr that I can fix with either a setting or different usage? Is this a driver bug? What sort of thing should I even be looking for next?
EDIT: Over 4,200 blank pages and counting later, I can confirm one extra detail. This happens whenever the
-o page-set=even argument is used and the source PDF file's page count divided by two is odd. In other words 4 page documents are fine (2÷2=even) but 2 page documents and 6 page documents fail (2÷2=odd and 6÷2=odd).
¹ These are church bulletins in regular and large print editions with and without included sheet music, so this has been done exactly once a week every week.