[cairo] Win32 printing

Vladimir Vukicevic vladimir at pobox.com
Mon Jun 25 08:48:31 PDT 2007

Hey Adrian,

This is pretty exciting stuff!  I'm glad to see that that you were able 
to get things implemented using the core GDI stuff.. a number of things 
(such as antialiasing) shouldn't be an issue where printing is 
concerned.  Some general comments...

Adrian Johnson wrote:
> I have also started work on extending the win32 surface to fix these 
> problems:
> http://gitweb.freedesktop.org/?p=users/ajohnson/cairo.git;a=commit;h=930d41687ce16798bf992e44d66cde4a67c89163
> The changes involve:
>   - In the win32-surface constructor if the device context is not a 
> display the surface is created as a paginated surface.
>     This allows to the paginated, meta, and analysis surfaces to be used 
> to identify and handle the unsupported printer
>     operations such as transparency as image fallbacks.

I would much rather this be a separate cairo_win32_printing surface 
(with a CAIRO_WIN32_PRINTING_SURFACE type) that the user can explicitly 
create; that way the decision over which path to go can be explicitly 
made by the API user, instead of being made in the internals.  The 
methods that should be shared with the current win32 surface can just be 
made non-static and placed in cairo-win32-private.h.  The two don't 
share a whole lot, so I think having them in separate files as well 
makes sense.

I'd like to plug the printing surface into Mozilla to see how it does 
with printing web stuff; I'd be happy to do the above work if you don't 
think you'll get a chance to get to it.

>   - Implement the _fill, _stroke, _paint, _show_glyphs, and 
> _intersect_clip_path backend operations. Where possible
>    the GDI functions that result in vector based PostScript output are 
> used. The existing show_glyphs function is used
>    when printing solid patterns.
> Testing with these changes appears to fix both issues. The PostScript 
> out is small and prints quickly. Images are embedded
> at their native resolution. Linear gradients are natively supported on 
> PS Level 3 printers. All transparency and cairo operators
> produce correct output.

How much of this is dependent on the printer driver doing the right 
thing?  Someone on IRC was mentioning that, e.g., GradientFill generates 
multiple-megabytes of postscript output on some printers (then again, 
the current cairo surface does the same thing, so maybe that's not such 
a bad failure case...).

    - Vlad

More information about the cairo mailing list