I’ve been working a bit on a printing API for gtk+. Its a highlevel API that integrates cairo, pango and a native print dialogs. Its really easy to get nice printing output, and it will work on all platforms, using native printing. I just made a code drop so that people can look at the APIs and comment on it.
The example code in it is pretty awesome, it actually prints itself. Here is the output pdf.
If you read that pdf you’ll see it produces some other output too. I’m sure interested parties can find that file too. 🙂
The text in the PDF isn’t sharp at all, it’s very blury. Is that a known issue?
It looks like the text is converted to a raster image. It could be from the printfile > pdf creation step (actually, I hope it is)…
Thats the current cairo pdf generator, work is going on to make that better.
Thought so, glad it’s being worked on.
Is there any documentation, or should we just look at the code? Can you provide some some practical examples of how this will make printing better?
Keep up the good work
Petar
Petar wrote:
> how this will make printing better?
This API will allow you to use the same Cairo based drawing code for rendering your document with your application as for printing it, sending it via mail, whatever – and if this should not be advantage enough: This API will support you on printer detection, paper setup and pagination. Well and it will be platform independent. Guess that should be sufficient advantage over handcrafted Postscript to lp piping, shouldn’t it?
tbf, I wasn’t tying to be unpleasant, I’m not a developer and I just needed clarification. Thanks for the info!
I’m glad that people are thinking about printing, I’ve felt it was forgoten for for some time…
@Petar: Sorry for being harsh. My work is quite unpleasant today, should try harder to find a job where I can work with the GNOME platform. :-/
You rock so much Alex! This piece of software is awesome and vastly improves the printing platform!
Alexander, my only concert having looked at the C API is that it looks like we have to use a different pango layout constructor function egg_print_context_create_layout(EggPrintContext *context) rather than pango_cairo_create_layout (cairo_t *cr) which we normally use when using pango with cairo.
Doesn’t this mean that we’d have to use different code to print to a pdf than to print to draw to the screen? I thought that was one of the main advantages of using cairo for Gtk+, that we could share our drawing and printing code.
Am I misunderstanding?
Duncan: pango_cairo_create_layout() is a convenience function that creates a PangoLayout for screen use. It sets the DPI based on display settings (i.e. almost always 96 dpi), not what the actual printer target DPI. If you use a layout from pango_cairo_create_layout() on a non-display target you’ll get the wrong results.
This is slightly unfortunate, but there is not much to do about it.