What's the easiest way to add custom page sizes to a .ppd?

joeforker picture joeforker · Jun 22, 2009 · Viewed 21.7k times · Source

I would like to add custom page sizes to my printer's .ppd (PostScript printer definition) file. What do I have to add to get a new page size working properly?

Answer

Kurt Pfeifle picture Kurt Pfeifle · Jun 24, 2010

You have to add values for each additional page size at 4 different places:

  1. for PageSize,
  2. for PageRegion,
  3. for ImageableArea and
  4. for PaperDimension

Best, you take one PPD and search for sections enclosed in these keywords

*OpenUI *PaperSize: PickOne
....
*CloseUI *PaperSize

.

*OpenUI *PageSize: PickOne
....
*CloseUI *PageSize

and for the sections starting with

*DefaultImageableArea: ...

.

*DefaultPaperDimension: ...

Use the lines you find in there as templates for your new entries. Note, that dimensions are given in PostScript points (where 72pt == 1inch ~= 2.54cm).

Caveats:

  1. Add your new lines at each of the 4 places in the PPD.
  2. Make sure you use uniq names for your new media sizes.
  3. Make sure you don't have any syntax errors in your PPD.
  4. Once you're done (or while you're at editing it), check your PPD with the cupstestppd utility (available on Linux and on Mac OS X).

Update

Regarding testing the PPD with cupstestppd:

By default, this will report errors as **FAIL** even if it finds some "not-so-important" syntax issues (PPD string translations, filters, UIConstraints, profiles, media sizes). You can relax these strict checks a bit and use -W all in order to report all these as warnings only, not as errors:

cupstestppd -W all /path/to/PPDfile.ppd

If this returns lines saying WARN size ... you should pay close attention to them and make sure you fix the PPD.