On the summit owen and some people hacked up a proposal for a Gtk+ printing API. It is availible in libegg/libegg/print in cvs. Having looked at various other APIs and platform requirements I have a different idea of how such a highlevel API could look. Attached is a example implementation of the API ideas. Look at testprint.c and testprintfileoperation.c to see how it is used. The basic idea is that each time you want to print (i.e. when the user selects File->Print) you create a new GtkPrintOperation, set various information on it like: * default page settings (size, orientation etc) * initial printer settings (from last print) * various settings controlling the print operation Then you kick off the operation, with egg_print_operation_run(). We then display a print dialog (if requested), and create a cairo context for the correct printing backend. Then various signals are emitted on the EggPrintOperation: begin_print: emitted at start, here you can e.g. allocate resources request_page_settings: emitted before page rendering, letting you change the page settings on a per-page basis draw_page: render the page nr given, return FALSE if no such page (you can hint on the nr of pages with egg_print_operation_set_nr_of_pages) end_print: emitted at end, even if cancelled, here you can free resources When this is done the job is sent to the spooler, and the function returns. We could add some form of feedback on the printing progress as other signals on the object. At this point you should get the new printer settings object and save that for the next print operation. Another way to use this API is to subclass EggPrintOperation, like the TestPrintFileOperation class in the example code. Opinions on this? =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Alexander Larsson Red Hat, Inc alexl redhat com alla lysator liu se He's a bookish vegetarian stage actor moving from town to town, helping folk in trouble. She's a mentally unstable wisecracking museum curator with a flame-thrower. They fight crime!
Attachment:
print2.tar.bz2
Description: application/bzip-compressed-tar