[Gambas-user] GTK and printing to printer

Rob Kudla sourceforge-raindog2 at ...94...
Sun Jan 29 20:17:25 CET 2006


On Sun January 29 2006 04:02, Christopher Brian Jack wrote:
> If that is true then it should be possible to make a
> component that uses CUPS directly to implement a printing 
> class independant of Qt and Gtk.

OK, again, CUPS implements a different part of the printing 
system than Qt and GNOME (not Gtk) do.  Qt and GNOME implement 
the printer as (essentially) a drawing object, and output 
Postscript to CUPS.  CUPS just takes the Postscript and 
translates it to whatever format the printer needs, along with 
job handling and all that stuff.  They're totally different.

> Alternatively make a printing class abstraction that outputs
> as PostScript and use the available component(s)
> (Qt/Gtk/whatever future interface components) to handle
> printing from the resulting PostScript.  This may not solve

I don't think you understand how big a job this would be.  Using 
Qt or GNOME for printing tasks means we get to use all their 
font handling and drawing abilities "for free".  Writing 
something higher-level that talks to CUPS directly would mean 
duplicating a lot of those toolkits' efforts.

It'd be possible, but I'm not volunteering to do that right now.

> and/or Operating System and environment.  I guess I'm forward
> thinking a bit to when there may potentially be Gambas in
> Windows (or other OSes say like MacOSX).  It seems to make
> sense to abstract printing to a single class the produces an
> common intermediary that is independant to whichever low level
> printing driver is ultimately available at runtime.

I fully expect that to happen someday.  Most form stuff has 
already been abstracted into gb.form.  Probably someday there'll 
be a gb.printer component too.  If nothing else, it will enable 
the use of a consistent printing API across all toolkits.

But gb.form still requires that your project use either gb.gtk or 
gb.qt, and gb.printer would still require that you use either 
gb.gtk.gnome or gb.qt or whatever other component provides 
higher-level print support.... unless someone is ambitious 
enough to write a gb.printer.native component or something 
similar that implements a drawing object (hmmm, guess that would 
require an abstracted gb.drawing component too) and outputs 
Postscript or PDF.  That sounds like a fun challenge, but not 
one I personally have time for.... can't speak for anyone else.

Rob




More information about the User mailing list