![]() |
CAPS Universe documentation
1.0.4
All you need to know to be successful
|
Generate PPD information based of the printer description. More...
Data Structures | |
| struct | color_model_string |
Variables | |
| static const struct color_model_string | cmodels [] |
| static struct caps_ppd_selection_entry | generic_duplex_entries [] |
| static const struct caps_ppd_selection | generic_duplex_selection |
| static struct caps_ppd_selection_entry | manual_feed_selections [] |
| static const struct caps_ppd_selection | manual_feed_selection |
| static const struct caps_ppd_selection_entry | generic_cutter_selections [] |
| static const struct caps_ppd_selection | generic_cutter_selection |
These functions translate the information from the printer description (provided by the printing provider/printing driver) into
The text file can be forwarded to the printing coordinator and will be used by the printing client to configure the print job in a printing device specific manner.
The array (or to be more precise: its content) will be used to setup the print job with data from the PPD selections and the IPP options (some of them also depends on the PPD content).
There are some keywords which are required:
DefaultImageableArea *DefaultPageRegion *DefaultPageSize *DefaultPaperDimension *FileVersion *FormatVersion *ImageableArea *LanguageEncoding *LanguageVersion *Manufacturer *ModelName *NickName *PageRegion *PageSize *PaperDimension *PCFileName *PPD-Adobe *Product *PSVersion *ShortNickName
*PageRegion + *DefaultPageRegion: for manual feed
*InputSlot Manual or *InputSlot ManualFeed. instead of *ManualFeed
*DefaultImageableArea will often be "Unknown" *DefaultPaperDimension as *DefaultPageSize, *DefaultPageRegion, and *DefaultImageableArea.
|
static |
Try to translate the description entry in a PPD file
| [in] | cpdi | The printing device information |
| [in] | string | The string to translate |
This routine tries to translate the given string into the local language (LANG) using the domain of the calling printing driver. If the printing driver does not support it, domainname can be NULL and this routine tries to use its own po files. Some strings are common and maybe a shared translation is already available.
|
static |
Create printer device product information
| [in] | cpdi | The static printer device info |
| [in] | prod_info | Printer device product information. Can be NULL |
Creates some always required entries:
*Manufacturer*Product*ShortNickName*ModelName*NickName *ShortNickName to 31 chars
|
static |
Supported level must be defined by the interpreter!
The "LanguageLevel" keyword can be omitted: We do not support PostScript yet.
|
static |
Create the PPD file header
| [in] | cpdi | The static printer device info |
| [in] | prod_info | Printer device product information. Can be NULL |
Don't know if this kind of information is important. At least it will not be part of the internal database representation.
|
static |
Create the printer type entries regarding its colour capabilities
| [in] | cpdi | The static printer device info |
The generated entries here aren't interpreted as the printer device capabilities. They are more meant to describe the printing driver which must deal with the data.
We violate the spec here, because it does not know a monochrome printer. It only mentions "gray" as a marker for printers with one colour only.
I think: Using 'monochrome' prints with dithering and 'gray' prints without dithering.
|
static |
Create the resolution's name
| [in] | res | The resolution to create the descriptive text |
According to the spec, the name should be of
|
static |
Create the resolution's descriptive text
| [in] | res | The resolution to create the descriptive text |
The descritpive text is of the form
|
static |
Create one entry to describe a printing resolution
| [in] | cpdi | Collected printing device info |
| [in] | res | Resolution entry to add |
|
static |
Create one entry to describe the default printing resolution
| [in] | cpdi | Collected printing device info |
| [in] | res | Resolution info |
|
static |
| [in] | cpdi | Collected printing device info |
From the spec about a single resolution:
"Builders of PPD files: If the device has only one resolution, *DefaultResolution may appear by itself, without *Resolution, *SetResolution, or any *OpenUI/*CloseU bracketing. See section 3.2 and section 4.5 for information on stand-alone default keywords."
|
static |
|
static |
| [in] | cpdi | Collected printing device info |
|
static |
| [in] | cpdi | Collected printing device info |
|
static |
| [in] | cpdi | Collected printing device info |
|
static |
Emit one selectable entry inside an OpenUI/CloseUI block
| [in] | cpdi | Collected printing device info |
| [in] | keyword | The base keyword the selection corresponds to |
| [in] | entry | The selectable entry information |
The generated output is a one-liner and has the form of:
*<keyword> <option>[<translation>]: "[<value>]"
|
static |
Emit an OpenUI/CloseUI selection block
| [in] | cpdi | Collected printing device info |
| [in] | selection | The selection information |
The generated output has the form of:
*OpenUI *<keyword>[<translation>]: <type> *OrderDependency: 10 AnySetup *<keyword> *Default<keyword>: <option> *[...] *CloseUI *<keyword>
|
static |
Emit all PPD selection entries (on demand)
| [in] | cpdi | Collected printing device info |
|
static |
Ensure valid defaults, if the leading edge setting is undefined
| [in] | setting | The leading edge setting from the printer driver |
The purpose of this function is to ensure the conformance to the documentation in caps_ppd_paper_leading_edges and caps_ppd_base::default_leading_edges
|
static |
Handle landscape orientation
| [in] | cpdi | Collected printing device info |
If the medium is blank, this attributes makes no sense, because it isn't important how you rotate the print from landscape to portrait. But it makes sense, if the medium is special (envelopes), has punch holes or is pre-marked already.
|
static |
Output the leading print medium edge (on demand)
| [in] | cpdi | Collected printing device info |
From the spec:
…allows the user to tell the print manager how the current input slot has been configured to feed the page. This is both an assertion of how an input slot is set up (for cut-sheet media) and a partial request for page image orientation (for roll-fed media). […] *LeadingEdge should be displayed as a PickOne menu and should follow the rules for PickOne keywords, although it is not surrounded by *OpenUI/*CloseUI
|
static |
Check if the given paper size fits into the physical limits of the printing device
| [in] | coverage | Physical limits of the printing device |
| [in] | width | Paper width to check |
| [in] | height | Paper height to check |
|
static |
Change the first character of the first word to upper case
|
static |
Create a list of PageSize, PageDimension or PageRegion entries
| [in] | cpdi | Collected printing device info |
| [in] | option | Name of the PPD option ('PageSize', 'PageDimension' or 'PageRegion') |
| [in] | printf_format | The format string (refer printf's manpage) |
| [in] | coverage | Physical limits of the printing device |
| [in] | include_value | 'true' to have the value in the option list as well |
The created list is based on the paper names the libpaper knows.
Creates the following entries, if option is
PageSize
and printf_format is
: \"<</PageSize[%.0f %.0f]/ImagingBBox null>>setpagedevice\"\n
*[…] *PageSize a4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice" *PageSize letter/Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" *PageSize note/Note: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice" *PageSize legal/Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice" *[…]
The "PageSize" keyword and its format name need to be part of the ppd option list! handle_ppd_parameter() relies on it.
|
static |
Emit one single paper dimension entry
Useful to read back the size in a generic manner
|
static |
Emit one single paper imageable area entry
Useful to read back the area in a generic manner
|
static |
Emit the definition for a paper in a single tray
| [in] | cpdi | Collected printing device info |
| [in] | default_format | The name of the default paper format |
| [in] | coverage | Physical limits of the printing device |
Used when the printer has exactly one tray with one paper loaded. Expectation is, this tray is loaded with a paper the user knows and has set in the configs. Offer this single paper to the printing clients
For example if 'DIN A4' is the loaded paper:
*DefaultPageSize: A4 *PageSize A4/A4: "<</.HWMargins [12.5 12.5 12.5 12.5] /PageSize[595 842]/ImagingBBox null>>setpagedevice"
We do not support PostScript anymore, so we are free here what string we provide to setup the page size
This entry is used by the print job generator to have an idea about the printing capabilities of the printer for this specific paper.
Some print dialougs only show this entry, if it is framed by OpenUI/CloseUI m( Since it would be nice to show the user the currently available paper format, we need to add these user interface entries...
default_format must be valid
|
static |
Emit the available paper definition for a multi tray
| [in] | cpdi | Collected printing device info |
| [in] | default_format | The default paper format from the list |
| [in] | coverage | Physical limits of the printing device |
In a multi tray printing device all page formats are possible.
We do not support PostScript anymore, so we are free here what string we provide to setup the page size
default_format must be valid
|
static |
Emit the available paper definition for a manual feed
| [in] | cpdi | Collected printing device info |
| [in] | default_format | The default paper format from the list |
| [in] | coverage | Physical limits of the printing device |
For a manual feed all page formats are possible.
We do not support PostScript anymore, so we are free here what string we provide to setup the page region
|
static |
Emit the custom media defintion
| [in] | cpdi | Collected printing device info |
| [in] | default_format | The default paper format from the list |
DefaultPaperDimension, the value of the DefaultPageSize is used instead to define all other related entries.
|
static |
Add a single paper dimension entry
| [in] | cpdi | Collected printing device info |
| [in] | default_format | The default paper format |
For the PPD this adds a PaperDimension and a DefaultPaperDimension entry. For the internal database only a PaperDimension is required.
DefaultPaperDimension, the value of the DefaultPageSize is used instead to define all other related entries.
|
static |
| [in] | cpdi | Collected printing device info |
| [in] | default_format | The default paper format in lower case |
Creates a PPD content of the following type (content depends on the papers known to libpaper)
*DefaultImageableArea: a4 *ImageableArea a4/A4: "1.41 12.50 595.10 829.39" *ImageableArea letter/Letter: "1.41 12.50 611.82 779.50" *ImageableArea note/Note: "1.41 12.50 611.82 779.50" *ImageableArea legal/Legal: "1.41 12.50 611.82 995.50" *ImageableArea executive/Executive: "1.41 12.50 521.82 743.50" *ImageableArea halfletter/Halfletter: "1.41 12.50 395.82 599.50" *ImageableArea halfexecutive/Halfexecutive: "1.41 12.50 377.82 509.50" *ImageableArea statement/Statement: "1.41 12.50 395.82 599.50" *ImageableArea folio/Folio: "1.41 12.50 611.82 923.50" *ImageableArea quarto/Quarto: "1.41 12.50 609.82 767.50" *ImageableArea a5/A5: "1.41 12.50 419.35 582.78" *ImageableArea a6/A6: "1.41 12.50 297.46 407.03" *ImageableArea b5/B5: "1.41 12.50 498.72 696.16" *ImageableArea b6/B6: "1.41 12.50 354.15 486.40" *ImageableArea c5/C5: "1.41 12.50 459.04 636.63" *ImageableArea c6/C6: "1.41 12.50 322.97 446.71" *ImageableArea dl/DL: "1.41 12.50 311.63 611.12" *ImageableArea comm10/Comm10: "1.41 12.50 296.82 671.50" *ImageableArea monarch/Monarch: "1.41 12.50 278.82 527.50" *ImageableArea flsa/Flsa: "1.41 12.50 611.82 923.50" *ImageableArea flse/Flse: "1.41 12.50 611.82 923.50"
|
static |
Define the paper size
| [in] | cpdi | Collected printing device info |
PageSize selects the paper tray as well (if known)
PageRegion should be used in conjunction with the manual feed, it does not select any paper tray
DefaultPageRegion can be "Unknown"
ImageableArea depends on portrait or landscape paper entry
DefaultImageableArea can be "Unknown"
MediaType optional, how to define?
Some information I found about their meaning:
https://lists.linux-foundation.org/pipermail/printing-summit/2006/000335.html On Tuesday 07 March 2006 13:43, Alexander Larsson wrote:
I'm working on the Gtk+ print dialog, and I have a question about PageSize and PageRegion.
It continues to confuse me, even after years of being exposed to these keywords. Let's see if I can remember correctly (don't have the PPD specs around here right now):
- PageRegion is meant to be used for describing the imageable area on a sheet that is fed from the "manual tray". (And the manual tray is mean to be able to grokk very weird paper sizes, not fitting into any of the predefined ones...).
- PageSize is meant to select a specific page size as is defined in the PPD by name. (Internally, PageSize is also an invocation to the physical printer to use an appropriate input slot and reserve an amount of memory in its interpreter to hold the image that will go to the
I'm not sure when and how to use these.
Ha!, there are even more "keywords" to be aware of, and which play their role in media selection: ImageableArea, PageSize, InputSlot, PaperDimension, MediaType, MediaColor, MediaWeight,...
Some of these, as well as their finely grained differences are more important for correctly authoring PPD files than for presenting their contents to the user GUI, though. (For the GUI, and for the user to take his picks, only the contents of "*OpenUI....*CloseUi" sections of the PPD are important.)
The ImageableArea is important in so far as it may describe a hard physical limit of the marking engine (which may be unable to print from paper edge to paper edge), and thusly should prevent/warn the application user if she designs a document that violates these limits; and/or the PostScript creation process should take care of these limits too.
MediaType is a way to select a specific medium (like "transparency", or "letterhead") without the user having to know which specific tray holds that medium. This option definitely needs correct setup on the device side first, before it is working correctly – but once set up, I'd expect it to work from the GUI.
MediaColor and MediaWeight are used similarly as MediaType (to select by color or by weight without knowing the actual slot); they also need prior device setup. (Of course, MediaType, MediaColor and MediaWeight keywords are present in only very few PPDs).
PaperDimension defines a paper by size (2 values: width and height), as opposed to by name (like "A4" or "Letter").
About InputSlot, see below...
Reading the PPD spec it seems like you're supposed to use PageSize if the user wants a specific page size, and doesn't care from where it comes, and PageRegion if the user specifies a specific InputSlot (and RequiresPageRegion for that slot is true).
PageRegion is for the input slot named as "ManualFeed".
However, I'm representing InputSlot as a dropdown selection in the UI, which means that InputSlot is always set (typically to its default value). In most use cases I think the user just wants to pick a page size though. In these cases we should ignore the InputSlot and use PageSize.
You can't "ignore" InputSlot selections. InputSlot and PageSize are two entirely different things. To give a few example data points:
- Most HP LaserJets for workgroups (as well as most other vendors' equipment) are extensible, and you can add several InputSlots to them by stacking an additional paper tray unit underneath the marking engine unit.
- These printers then may have up to 10 or more input trays; and each input tray may have flexible guides, that allow loading of different paper sizes (A5, A4, A3, Legal, Letter...).
- Physical printers may or may not have a "media size autosensing" capability; humans may or may not have to "tell" the printer the mapping of "A4 size is in tray 1, A5 in tray2, and A3 in tray3".
- You may have 10 trays, each one with white Letter paper; selecting a specific slot may not be of any relevance.
- You may have 4 trays with different sizes or different paper colors (or letterhead forms), and a user may specifically select one slot specifically to really get the red A3 sheet to print on.
- PageSize determines how the print "image" is to be sized for each sheet; it is a parameter that the PostScript generating program very often wants to be made aware of before it generates the (PS) printfile. (Here the "ImageableArea" value is also to be considered).
- Usually, users of such printers know (or are told by their admins) which slot holds which paper type.
- Some printers will print if "PageSize=A3" and "InputSlot=tray3" is selected even if "tray3" feeds only a A5 paper size (resulting in an "overflowing" image on the sheet); some printers will reject the job and display an error message on their front panel display, or ask for changing tray or load a different paper size.
The obvious way to handle this would be to have an "automatic" choice for InputSlot and use PageSize when that is set. I've been looking at various existing ppds it looks like some have "Auto" or "AutoSelect" choices. Is this something i can rely on?
Unfortunately, this is not always implemented correctly in some of the "professional" laser printers as are used in enterprises...
"Autoselect" choices are meant to give the physical printer the freedom to switch paper trays which are loaded with paper of equal sizes "on the fly" (if the first one in use is running out of paper in the middle of the job). You either make sure that all A4 trays of the printer are loaded with paper of the same white color, or you don't care if the paper color changes in the middle of the job from yellow to red since the yellow one was used up.
Pinning a paper tray (using any tray specifically, but not letting the printer do "autoselect") by explicitely choosing it will let the printer stop once that tray is empty (even if it has 5 other trays with the same sizes loaded).
Cheers, Kurt
Chapter 6.3 of the PPD spec has an example for label printer *MaxMediaWidth, *MaxMediaHeight, *HWMargins should be listed in the PPD
|
static |
Create duplex capability on demand
| [in] | cpdi | Collected printing device info |
|
static |
| [in] | cpdi | Collected printing device info |
|
static |
| [in] | cpdi | Collected printing device info |
Supported fonts must be defined by the PS interpreter and the available fonts
|
static |
Add a cutter selection on demand
| [in] | cpdi | Collected printing device info |
|
static |
Create all parts of the PPD based on printer driver's settings
| [in] | cpdi | Collected printing device info |
| [in] | prod_info | Printer device product information. Can be NULL |
|
static |
|
static |
Duplex printing capability choices
The names used here correspond to the keywords used by IPP parameter sides Description
|
static |
Duplex printing capability selection
|
static |
Paper source choices, if the printer has a manual feed
|
static |
Paper source selection, if the printer has a manual feed
|
static |
Let the user select if the cutter should does its work
|
static |