How to set the minimum margin in CUPS / foomatic driver?

7

6

I have a Dell 2130cn laser printer which has no PPD print driver for CUPS, so I used the generic foomatic PCL6 (/pxlcolor if that matters), and it's not correctly recognizing my printer's print margins and so forcing it to use 0.5" for top and bottom, and 0.25 for left and right.

How do I manually tell either CUPS or the foomatic driver that I my printer actually has 0.1" print margins?

ethanwu10

Posted 2016-01-15T03:18:32.597

Reputation: 931

Answers

9

It turns out that the problem is not with the hardware margins in the printer; the page definitions in the ppd file had set a printable area with 0.5" and 0.25" margins for a letter page.


To fix this, edit the ppd for the printer (/etc/cups/ppd/yourprintername.ppd):
Find the list of *ImageableArea definitions of page sizes:

*DefaultImageableArea: Letter
*ImageableArea Letter/US Letter: "18 36 594 756"
*ImageableArea A4/A4: "18 36 577 806"
*ImageableArea 11x17/11x17: "18 36 774 1188"
*ImageableArea A3/A3: "18 36 824 1155"
*ImageableArea A5/A5: "18 36 403 559"
*ImageableArea B5/B5 (JIS): "18 36 498 693"
*ImageableArea Env10/Envelope #10: "18 36 279 648"
*ImageableArea EnvC5/Envelope C5: "18 36 441 613"
*ImageableArea EnvDL/Envelope DL: "18 36 294 588"
*ImageableArea EnvISOB5/Envelope B5: "18 36 481 673"
*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504"
*ImageableArea Executive/Executive: "18 36 504 720"
*ImageableArea Legal/US Legal: "18 36 594 972"

Find the paper size you want to modify the margins for and change the definition (the part in quotes) to match your printer's actual print margins:

Format: "<bottom-left x> <bottom-left y> <top-right x> <top-right y>"

Margin + printable area must remain constant
For me 72 units = one inch (so 0.1" is approximately 8 units)

So:

*ImageableArea Letter/US Letter: "8 8 604 784"

gives the desired 0.1" margin on the print area

ethanwu10

Posted 2016-01-15T03:18:32.597

Reputation: 931

4

Note that the format is actually "<bottom-left x> <bottom-left y> <top-right x> <top-right y>". See PostScript Printer Description File Format Specification.

– Derek Veit – 2018-07-25T18:49:52.723

This actually helped to solve another problem I had that one type of paper and also an envelope size we use in my country not being present in these definitions. I usually had to do "magic" by using a large available standard and arranging the file to be printed to use the available area - I had many 'try-catch' moments to be able to centralize everything accordingly. Now it is easier to edit and save this *.ppd file. Sweet and happy random findings in Super User! :) – José – 2019-01-22T17:36:56.350

This hint is really helpful, helping us to print full screen 5'' photo out of a cups printer successfully without the margin. The command line we used is: lpr -P <Your_InkJet> -o media=3.5x5.Fullbleed <path-to-your-image> – tedyyu – 2019-03-20T14:24:09.533

0

The LinuxFoundation website has a script you can download to configure the margins using CUPS and the Foomatic driver

  1. Adjust the print margins. (If you are not using Foomatic or if the margins on your printouts are correct, skip this step). Download the files align.ps and alignmargins, then run alignmargins as root and follow the instructions:
cd /tmp
wget http://www.openprinting.org/download/printing/align.ps
wget http://www.openprinting.org/download/printing/alignmargins
chmod 755 alignmargins


su ./alignmargins
sudo alignmargins 

This will add the Margins print option so you can turn on ("lpr -o Margins=Custom printfile", default setting) or off ("lpr -o Margins=Default printfile") your adjustments. Note that this does not work for all drivers.

Jonno

Posted 2016-01-15T03:18:32.597

Reputation: 18 756

I don't know if I'm doing something wrong, but I set the margins to something other than what it originally had, and when I printed (using the new margin settings) it was still using the wrong margins (and it was offset on the page, but that was probably just me configuring the alignment wrong) – ethanwu10 – 2016-01-16T19:43:08.040

0

*ImageableArea sets the area of your image to capture and print.

It does not set the printer page area.

Here is a sample image that gets cut off on the left side when printed in landscape on my Canon MG2900.

This happens because this printer needs a 2/3" margin at the bottom of page, or the left side of the rotated landscape page. In other words it can't print on the last 2/3" of the page.

In order to print this page fully, without cutting it off, it needs to be squeezed down a little so it will fit within the area that this printer can print in. (Unfortunately, scaling it down didn't fix this. It would move the right text in, but still cut off the left side of the page.)

To fix this, you set the ImageableArea to the part of the image that you wanted printed.

In this example, for a US-Letter sized paper (8.5" x 11"), there is about a 1/4" white margin all around the pdf. So the settings are 1/4" 1/4" 8.5" 11", but converted to pix (by multiplying them by 72, or 18 18 612 792).

  • The first option sets the left white space to ignore in your source image, or top if in landscape mode.

  • The 2nd option is similar but for the top white space to ignore.

  • The third option sets the total width to capture from the image, or at least that's what it looks like to me. So perhaps the first option is both the left and right margin. (Sorry, but "I'm not sure. It's very confusing, but I finally got it to work for me.)

  • The forth option is similar but the height.

You must restart CUPS after you make these edits. Also be careful to keep the file ownership to root:lp. Comments are ok with *% prefix.

Elliptical view

Posted 2016-01-15T03:18:32.597

Reputation: 864