Re: A few quick questions about gtkprint



On Wed, 15 Apr 2009 15:33:03 +0530
Vamsi Krishna Davuluri <vamsi davuluri gmail com> wrote:
Thanks for your effort and time Chris!
That pretty much answers all of my questions, one question though,
will poppler and such libs really be necessary when the file can
already be viewed by an application? As I think if a page can be
viewed, without doubt it  can be rendered to cairo objects.
I have gone through gtkprint previously, made a simple printing
program in python which read text mime types. and could print as pdf
or to the printer.

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]