PS/PDF API Change Proposal: (Re: [cairo] Semantics of transparent objects)

Michael Sweet mike at
Fri Feb 10 04:40:14 PST 2006

Carl Worth wrote:
> On Wed, 18 Jan 2006 20:01:04 -0500, Michael Sweet wrote:
>> Carl Worth wrote:
>>> ...
>>> Obviously, there _are_ a lot of printing-specific options, settings,
>>> and metadata that users will need to provide. And the point has been
>>> made above that these need to be available on a per-page basis.
>>> I'm wondering if we can't just use cairo_t for these, and specify that
>>> the time to set them is before any drawing operation on any given
>>> page. That is, just after cairo_create or cairo_show_page, and before
>>> any of cairo_stroke, cairo_fill, cairo_paint, cairo_mask,
>>> cairo_show_text/glyphs on that page.
>> That would work.  IMHO, the only "required" per-page attributes are
>> the media attributes: media color (the color of the paper, not whether
>> the output is in color), page size, media source, media type, and
>> media weight.
> What's not clear to me yet is what cairo is supposed to do with these
> options. From the recent discussion on the desktop_printing list[*]
> it's been made quite clear that applications should emit
> printer-independent PostScript and that that should be passed along
> with printer-specific options to CUPS.

True, however that doesn't prevent inclusion of per-page options, you
just need to do it a little differently using %%IncludeFeature...

> So, cairo fits in on the PostScript-generation side of things. And if
> it should then always be generating printer-independent PostScript
> then I don't see why it should see any printer-specific settings, (or
> even what it could do with them if it shouldn't put them into the
> PostScript output).

At the very least you may want a mix of page sizes...

> Or are all the attributes you describe above printer-independent? I
> don't know for sure what you mean by "media source" for example. Is
> that the printer's paper tray? If so, that's clearly printer-specific.

Right.  Maybe an example will help:

     %%Page: 1 1
     %%PageBoundingBox: 0 0 595 842
     %%IncludeFeature: *PageSize A4
     %%IncludeFeature: *InputSlot LargeCapacity
     %%IncludeFeature: *MediaType Glossy
     %%IncludeFeature: *MediaColor White

The PageBoundingBox comment tells CUPS the bounding box of the page.
It is important to note that the coordinates are *integers*...

The IncludeFeature lines allow you to inject per-page options without
putting printer-specific PostScript commands in the file...  They
also make sure that the options are set in the right order...

Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software

More information about the cairo mailing list