Bug 15576

Summary: [GTK] Printing support
Product: WebKit Reporter: Alp Toker <alp>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: christian, cosimoc
Priority: P2 Keywords: Cairo, Gtk
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Initial printing support, WIP
none
Nearly feature complete
none
Abstracted PrintContext class
none
Print button for GtkLauncher
none
Add printing support none

Alp Toker
Reported 2007-10-20 07:32:11 PDT
We need to implement printing support, Probably using GtkPrint. We will need to clean up some assumptions about Gdk during the rendering process, say in native widget theming, but Cairo does most of the work for us here when it comes to generating PS and PDF.
Attachments
Initial printing support, WIP (5.40 KB, patch)
2007-11-19 04:14 PST, Alp Toker
no flags
Nearly feature complete (7.99 KB, patch)
2007-11-22 13:05 PST, Alp Toker
no flags
Abstracted PrintContext class (8.27 KB, patch)
2007-11-22 15:04 PST, Alp Toker
no flags
Print button for GtkLauncher (1.02 KB, patch)
2007-11-22 15:08 PST, Alp Toker
no flags
Add printing support (9.80 KB, patch)
2007-12-12 05:48 PST, Alp Toker
no flags
Alp Toker
Comment 1 2007-11-19 04:14:49 PST
Created attachment 17396 [details] Initial printing support, WIP This is the start of printing support. It adds one public entry point, webkit_frame_print(), and also adds support for launching print jobs from within pages. You need a recent version of Cairo to get high-quality PDF output with selectable text and vector graphics -- older versions rasterize the entire document. Still TODO: Calculate page rects. Add support for more than just the first page. Disable font hinting when in print mode. This problem needs to be dealt with for features like text scaling in other places too. API: Decide whether webkit_frame_print() is correct -- I just made it up. Do we want a function on WebKitPage as well/instead? Do we want this to be overridable in subclasses? Thoughts welcome.
Alp Toker
Comment 2 2007-11-22 13:05:57 PST
Created attachment 17448 [details] Nearly feature complete This revision of the patch now paginates correctly. Questions arising: What should the public API look like? Should it be on WebKitPage, WebKitFrame or both? There is an ugly global that needs to go before the patch is ready. (I won't be looking into header/footer support.)
Alp Toker
Comment 3 2007-11-22 15:04:38 PST
Created attachment 17452 [details] Abstracted PrintContext class Still has mix 'n' match coding style because I can't bear the look of "gpointer userData". Not finished yet.
Alp Toker
Comment 4 2007-11-22 15:08:48 PST
Created attachment 17453 [details] Print button for GtkLauncher
Christian Dywan
Comment 5 2007-11-23 12:37:33 PST
Please surround printing code with #if GTK_CHECK_VERSION(2, 10, 0). At some point it would be nice to allow for manual page setup from a client app, but this can go in a separate bug once this one is done.
Alp Toker
Comment 6 2007-12-12 05:48:56 PST
Created attachment 17862 [details] Add printing support It's a shame to leave this patch in the bug tracker, it works really well. Coding style is intentionally not consistent wrt. camelCase vs. under_score since I expect the the print spooler will be split out and maybe even shared with other ports in the near future. No public API change.
Alp Toker
Comment 7 2007-12-12 08:14:19 PST
Comment on attachment 17862 [details] Add printing support r=holger
Alp Toker
Comment 8 2007-12-12 08:15:36 PST
Landed in r28648 with minor style fixes.
Note You need to log in before you can comment on or make changes to this bug.