[cups.general] Print dialog boxes in applications (Linux)

Kurt Pfeifle k1pfeifle at gmx.net
Fri Sep 7 03:00:21 PDT 2007


John Jason Jordan wrote:

> OK, I opened the PPD file in /etc/cps/ppd and read through it. There
> were several page size sections, and I didn't quite grasp why the list
> of page sizes appears more than once, although one section lists
> "PageSize" and another lists "PageRegion." However, while most of it
> was confusing, I did discover why Scribus uses different names for some
> of the page sizes. The following snip from the PageRegion section of
> the PPD file will make it clear:
> 
> *PageRegion FanFoldGermanLegal/US Folio: "
>   <<
>     /PageSize [612 936]
>   >> xerox$pagedevice copy xerox$setpagedevice
> "
> *End
> 
> In other words, the page sizes are listed twice for each page size.
> Scribus is taking the first one (e.g., "FanFoldGermanLegal," and all
> other applications are taking the second one (i.e., "US Folio").
> Evidently FanFoldLegalGerman is the same as US Folio.

Ah... that's the bug I reported a few days ago (informally, in IRC) to
one of their core developers.

They parse the PPD UI elements in a wrong way. These elements are con-
structed like this:

  *SomeOddOption *InternalNameForOddOptionValue/What the user should see in the GUI: "some code to execute if selected"

This bug does not exhibit itself very blatantly in the case of page
sizes. Because here the InternalNames are the same or very similar to
"What the user should see".

It is different if you have a PPD that drives a printer with, say a
few different output trays:

  *OpenUI *OutputBin/Output Destination: PickOne
  [....]
  *OutputBin Bin4/Finisher Upper Exit: "<</OutputType (1Bin)>>setpagedevice"

Scribus displays as possible "OutputBin"s the "Bin1"-"Bin5" options.
This, a user cannot understand easily (only after "Trial and Error").

Instead, it should tell the user about "Output Destination"s the
"Upper Side Tray", "Lower Side Tray, "Finisher Staple Exit", "Finisher
Upper Exit" and "Finisher Pamphlet Maker" options. Here the meaning
is very obvious.

However, in the most recent version of Scribus this seems to be fixed
already.


>> BTW, CUPS can also use "Custom" page sizes from the command line (it
>> just doesn't display them in the web interface);
>>
>> http://openprinting.blogspot.com/2007/09/how-to-set-custom-page-sizes-with-cups.html
> 
> That is very interesting. However, if I must specify a custom page size
> with an lp command, how do I tell it to selected Extra Thick Paper, one
> of the options of this printer? 

First investigate from the command line what the PPD offers:

  lpoptions -p printername -l | grep

You should see something like this as the output:

  MediaType/Paper Type: *Plain Recycled Special Colored Letterhead \
                         Preprinted Prepunched Labels Bond Cardstock \
                         OHP Thick ExtraThick Thin None

(For all lines of the "lpoptions -l" command: what is marked with an
asterisk ('*') is what is the current default)

Now conclude that it is probably the "Thick" keyword you need to use:

   lp -d printername -o MediaType=ExtraThick ....

[....]
> Not only that, but there are a ton of other print options
> involving color saturation, halftone screening, and I could go on and
> on. How do I get the syntax that lp needs in order to specify these
> things? 

Same as above. Use the same command as above, without the "|grep ..."
part to see *all* PPD options.

> As for the custom paper sizes, there was some stuff in the PPD file
> about it, although I did not understand a word of it.

Heh...

To understand it *all*, you need to grok the official PPD specification:

   http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf

plus, a little bit of PostScript too:

   http://partners.adobe.com/public/developer/en/ps/PLRM.pdf
   http://en.wikipedia.org/wiki/PostScript

> I should also add
> that the user can create custom paper sizes on the printer's control
> panel. Having done so, you can set the manual tray to any of your
> custom paper sizes. This is all done from the printer control panel.
> The problem is that if I print from a print dialog box and cannot
> specify the custom paper size, the output is always wrong. 

The one major weakness in KDEPrint' kprinter (as of KDE 3.5.x) is that
it still does not support keying-in of arbitrary values for custom
paper/media sizes. (Given the fact that usually those who are in need
of printing to custom page sizes regularly are only doing so with one
or two different ones, you can work around this by adding the sizes
to the PPD yourself; just make sure you add them to all 4 sections in
the PPD: "PageSize", "PageRegion", "ImageableArea" as well
"PaperDimension", and give them uniq new names).

You may want to look at the "xpp" print command GUI. You can use it,
just like kprinter, as a standalone app. It allows you to key in the
specific custom page size you want to use.

If you want to "replace" kprinter as the print command for KDE applica-
tions, just switch to "Print Through an External Program" in the ori-
ginal kprinter dialog, and specify "xpp" as the Print Command. As a
result, xpp will pop up after kprinter, and allow you to make the real
custom media size selection.

For most Gnome apps, you are able to specify "xpp" as a print command
too.

-- 
Kurt Pfeifle
System & Network Printing Consultant ---- Linux/Unix/Windows/Samba/CUPS
Infotec Deutschland GmbH  .....................  Hedelfinger Strasse 58
A RICOH Company  ...........................  D-70327 Stuttgart/Germany




More information about the cups mailing list