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:

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:

After copying the PPD driver in /etc/cups/ppd and giving it the name of the configured printer, i.e:

then we see a different thing, the PPD has been loaded (Generic PCL 5 Printer Foomatic/gimp-print)

If we do a cat of the PPD file:

Now using the real PPD file for HP LaserJet Managed E60075:

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».

After adjusting the image registration I’ve finally reached the perfect printing 🙂

This post is intended to serve as a guide for my future self.