Ah, the old art of printing stuff in paper is still something nowadays.
From time to time I must setup printers (yeah, several models of: Oki, Lexmark and HP) to print bank checks in a A5 pre-formatted paper.
It sounds easy at first, you setup the printer trays with the correct paper size, you send print from your Linux and it should work… right?
Well, sometimes it is easy, and sometimes isn’t.
List of things to consider before printing
- Physical paper size | The real size of our real paper
- Digital paper size | The size of our digital document
- Printer’s tray size | The size of the physical tray in our printer
- Printer’s ImageableArea or Image Registration (for HP) | Position/Margins of the digital document on the physical paper
- Driver paper dimensions / ImageableArea (PPD Drivers)
- CUPS (Printer Configuration and PPD compatibility).
The paper digital and physical sizes
Let’s take a look on the different sizes we must consider, in my example I need to setup an A5 vertical sheet to print an A5 digital document, but the measure of every tool is different:
- A5 Standard (taken from here): 148x210mm
- Our physical paper size (yeah, the real one): 5.984252 x 8.346457 (inches) | 15,2cm x 21,2 cm
- HP Printer personalized tray to match the real paper size (tray of HP E60075): A5
- HP Default printer options X,Y Dimensions: 8.46 x 13.98 inches (default) | changed to: 5.984252 x 8.346457
- evince | GNOME Document Viewer 3.22.1: A5, Landscape (8.26 × 5.83 inch) | 148.082 mm x 209.804 mm
- pdfinfo | version 0.48.0: Page size: 595 x 420 pts (postscript points) | 148.167 mm x 209.903 mm
- postscript PCL/PPD driver: *PaperDimension A5/A5: «419.760009765625 595.440002441406» (postscript points)
Points, inches and millimeters, different measures which you must match. We must setup everything according the physical paper size.
As we can see, there are small differences between some sizes (so we could expect some millimeters of deviation), some times after you print you notice the document is incomplete (because it’s margins), usually you can correct this from the Margins/Image Registration in your printer, but always consider the previous points to be configured correctly.
The physical paper size is different compared to the information obtained from the digital PDF .
I will setup manually the printer tray dimensions, the E60075 recognized it as A5.
The printing order in Linux has been created this way:
lpr -P HPE60075 -omedia=A5 -osides=two-sided-short-edge my_check.pdf
The CUPS version and PPD version
Well, if you do not copy a driver (PPD) for your printer it will be taken as «Local Raw Printer» when using lpoptions:
MORTIZSERVER:/etc/cups # lpoptions -p HPE60075 finishings=3 copies=1 job-hold-until=no-hold job-priority=50 number-up=1 auth-info-required=none job-sheets=none,none printer-info=HPE60075 printer-is-accepting-jobs=1 printer-is-shared=1 printer-location printer-make-and-model='Local Raw Printer' printer-state=3 printer-state-change-time=1509374263 printer-state-reasons=none printer-type=4
After copying the PPD driver in /etc/cups/ppd and giving it the name of the configured printer, i.e:
# printers.conf <Printer HP_LaserJet_E60075> # your PPD Driver in /etc/cups/ppd should be: HP_LaserJet_E60075.ppd # Restart CUPS!
then we see a different thing, the PPD has been loaded (Generic PCL 5 Printer Foomatic/gimp-print)
MORTIZSERVER:/etc/cups/ppd # lpoptions -p HPE60075 media=A4 finishings=3 copies=1 job-hold-until=no-hold job-priority=50 number-up=1 auth-info-required=none job-sheets=none,none printer-info=HPE60075 printer-is-accepting-jobs=1 printer-is-shared=1 printer-location printer-make-and-model='Generic PCL 5 Printer Foomatic/gimp-print (recommended)' printer-state=3 printer-state-change-time=1509374263 printer-state-reasons=none printer-type=4100
If we do a cat of the PPD file:
MORTIZSERVER:/etc/cups/ppd # cat HPE60075.ppd |grep Foomatic *% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This *NickName: "Generic PCL 5 Printer Foomatic/gimp-print (recommended)" #etc...
Now using the real PPD file for HP LaserJet Managed E60075:
MORTIZSERVER:/etc/cups/ppd # lpoptions -p HPE60075 media=Letter sides=one-sided finishings=3 copies=1 job-hold-until=no-hold job-priority=50 number-up=1 auth-info-required=none job-sheets=none,none printer-info=HPE60075 printer-is-accepting-jobs=1 printer-is-shared=1 printer-location printer-make-and-model='HP LaserJet E60055-E60075 Postscript (recommended)' printer-state=5 printer-state-change-time=1540564853 printer-state-reasons=cups-missing-filter-error printer-type=37076
Unfortunately I’ve tried using the latest LaserJet Managed E60075 PPD Driver which I’ve obtained after installing HPLIP but it is not compatible with my CUPS 1.3.9, it worked with CUPS 2.1.1 but I can’t update our cups servers for several reasons. I’m uploading all the ppd drivers for HP and Lexmark with cups configurations here. (And hoping you won’t need this never).
Then I tried using a Lexmark PPD (don’t ask me why) which I had over there, it worked but the printing was cut, so I’ve aligned the printer to do it right:
Because of the orientation of the paper on the printer and because my document is being printed in Duplex it must be «Back-side». If it was only one sheet I just would adjusted the «Front-side».
This post is intended to serve as a guide for my future self.