Recent Changes - Search:

Tips & Tricks

Windows Tips

Vista Tips

MS Server Tips

Apple Tips

Linux Tips

Networking Tips

Business

powered by PmWiki

PrintingCUPS

How to set Custom Page Sizes with CUPS Printjobs

So you have one of those sophisticated office printer models with adjustable guides that allow you to use any weird media size (with some sensible min/max value for width and height)? And you don't know how to tell CUPS to use that size when printing?

Try one of these commands:

lp -d printername -o PageSize=Custom.4x6in \

         -o fitplot /path/to/PDF ;      # inches

lp -d printername -o PageSize=Custom.4x8cm \

         -o fitplot /path/to/PDF ;      # cm

lp -d printername -o PageSize=Custom.440x310 \

         -o fitplot /path/to/PDF ;      # points (1/72 of an inch)

These assume a few things:

  • "printername" is the name of your shared printer
  • you want to print a PDF file
  • you want to make the printout fit onto the medium ("fitplot")

The "fit onto the medium" will happen automatically. CUPS will scale the page image up or down to the size that makes you PDF fit onto the sheet. It will also automatically rotate a page, if that makes it fit better into the available space.

This works also if you print other file types. And it even allows you to use fractions of an inch or cm units:

lp -d printername -o PageSize=Custom.5.5x6.9in \

          /path/to/ASCII.txt ;

lp -d printername -o PageSize=Custom.5x8.2cm \

          -o fitplot /path/to/Photo.jpg ;

lp -d printername -o PageSize=Custom.440x310 \

          -o fitplot /path/to/Scanned.tif ;

Supported image formats for CUPS printing are all of the commonly know, plus some more obscure ones: JPEG, TIFF (but not multipage TIFF!), PNG, GIF, PNM, PPM, SUN Raster, .... When the CUPS scheduler receives a printfile, it applies its "auto-typing" mechanism against it to find out its file format ("MIME type").

The received job format is then converted by an appropriate filter into a different one to make it better suited for further processing. (Overall, there may not only be one filter, but a whole chain of different ones which form a pipeline until the job is in a format that can be consumed by the target printer.)

With image and graphic formats, the first filter in the chain typically is "imagetops" or "imagetoraster". Both these filters understand the "fitplot" parameter that you gave on the above commandline, and act accordingly while converting their input into PS (PostScript) or CUPS Raster format.

You did notice that the "fitplot" parameter was skipped in the printing of the text, yes? Well, it does not make much sense here. Instead, to customize the size of your printed text you can specify "cpi" (characters per inch) and "lpi", as well as top, bottom, left and/or right margins:

lp -d printername \
-o PageSize=Custom.10x12cm /path/to/ASCII.txt \
-o page-top=33 \
-o page-bottom=44 \
-o page-left=60 \
-o page-right=80 \
-o lpi=5.53 \
-o cpi=11.3 \
/var/log/cups/page_log

You can use this to "print to file" and generate PostScript pages that do have appropriate BoundingBoxes for leaflets /brochures you are going to hand to a commercial printshop for transfer onto paper. Or you can further process said PostScript into a polished PDF presentation that fits exactly on the wide screen of your shiny new notebook. (You don't know how to "print to file"? You don't know how to convert a PostScript to PDF?


References

Open Printing BlogSpot - Retrieved 9 September 2007


All text is available under the terms of the GNU Free Documentation License
Privacy Policy | About Wikitec | Disclaimer | Copyright

Edit - History - Print - Recent Changes - Search
Page last modified on 2008-01-11 22:00