Re: A few quick questions about gtkprint



Thank you again!
Here is the code I was talking about; my code pretty much does the job of
printing .txt files and related mime types,
http://pastebin.be/17838
But I would love to see your code as well.

Our Read activity (sugar apps are called activities) supports a plethora of
formats (let me just check how it draws on screen), okay it uses the evince
library, meaning I should be able to draw to a Cairo context right? as the
underlying lower level implementation would be cairo if I am not mistaken?
(let me make sure that too). Yep evince uses poppler for pdf, and that cairo
as backends.



On Wed, Apr 15, 2009 at 4:15 PM, Chris Vine <chris cvine freeserve co uk>wrote:

I think that will depend on the application.  If it draws pages using
cairo and then paints them directly to X server side objects
(eg GDK drawables via gdk_cairo_create()) then you are in a very
straightforward position because you should be able to use the same
drawing functions when drawing to cairo surfaces for painting to the
print cairo context.  All you may have to do is do some scaling of the
print cairo context.

If the application doesn't do that, but you can get hold of (or convert
to) pixel data in an image format supported by
cairo_image_surface_create_for_data() then you can use that to paint to
the print cairo context (after scaling).

If though the application uses higher-level GTK+ interfaces to display
program material, such as GtkTextView, then I think you are going to
have to draw the text yourself with pango-cairo.  If it is just pure
text you are thinking about, this is pretty straightforward (I can send
you an url to some code I have written to print plain text log
files using GtkPrintOperation if you like).

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]