2

I cannot find what properties of CUPS must be used, for printer margins, left/top/etc. Maybe CUPS dont support margins at all? I wanted to add margins support to Lazarus CUPS code.

Prog1020
  • 4,530
  • 8
  • 31
  • 65

1 Answers1

4

Not sure if I understand your question correctly...

Note, that the support of controlling margins on the printed paper is dependent on the file type you submit for printing. This may not be supported for the one you want to print!

Assuming you print a TEXT document, here are the controls offered by CUPS lp command to submit the document as a print job to a CUPS printer with a custom page appearance:

lp                  \
  -h cupsserver     \
  -d printername    \
  -o cpi=11         \
  -o lpi=4          \
  -o page-bottom=36 \
  -o page-top=72    \
  -o page-left=100  \
  -o page-right=6   \
  textfile.txt

The '-h cupsserver' part is optional and can be skipped if the queue is defined on your localhost. The 'cpi' parameter (characters per inch) determines the width of each character on a line. 'lpi' (lines per inch) works similar. 'page-top/bottom/right/left' is the margin in PostScript points. (72 points are one inch.)

If you submit a PDF file instead of text (which is a format that already internally has cast its page properties, including margins, into its code), the following should work, but I haven't tested it:

lp                  \
  -h cupsserver     \
  -d printername    \
  -o fitplot=true   \
  -o page-bottom=36 \
  -o page-top=72    \
  -o page-left=100  \
  -o page-right=6   \
  pdffile.pdf

This should attempt to scale the page contents, but will probably scale more than you expect since it cannot do a "fluid" scaling to respect all the wanted borders (only a "preserve original page ratio" scaling).

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345