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.
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.
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.
Created attachment 17448 [details]
Nearly feature complete
This revision of the patch now paginates correctly.
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.)
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.
Created attachment 17453 [details]
Print button for GtkLauncher
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.
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.
Comment on attachment 17862 [details]
Add printing support
Landed in r28648 with minor style fixes.