Re: A few quick questions about gtkprint



On Wed, 15 Apr 2009 07:02:07 +0530
Vamsi Krishna Davuluri <vamsi davuluri gmail com> wrote:


hello,

I am a gsoc applicant for sugar, and doing a project which adds print
support to our applications.
The idea is to convert our mime types to a more printable format and
print them.
So, now the question is how does convertion to ps/pdf take place with
gtkprint
I would like to know if it is true that gtkprint uses a common filter
for converting to pdf/ps for any application?
or will it again interact with different respective filters?

At the library user level, gtk-print doesn't convert to ps or pdf in
order to print. It uses cairo/pango-cairo to write each page to a cairo
context.  It becomes clearer if you look at the documentation for
GtkPrintOperation (including the "draw-page" signal) and
GtkPrintContext.  After the drawing of the document with cairo has been
completed, gtk-print will convert those pages to postscript where unix
(cups or lpr) rather than windows is the underlying print system, but
that is not for the user to do nor bother with.

Since you refer to sugar, you may be doing this in python.  The py-gtk
documentation is generally pretty good (better in some respects than
the C interface documentation) so look at gtk.PrintOperation and
gtk.PrintContext etc., which covers the same ground with some
mini-examples.

As it happens, if you are only interested in running your programs
under unix-like operating systems, you can print a pre-prepared
postscript document using GtkPrintUnixDialog and GtkPrintJob with the
gtk_print_job_set_source_file() function, but doing that would offer
less features. You could not for example select the pages to be
printed, nor scale it nor set the margins, and it is not really the
best way to do it. So it is best to stick to the high level
GtkPrintOperation/cairo interface in order to give users what they
expect.

Chris



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