[webkit-gtk] Reload page before actual printing

Dan Vratil dvratil at redhat.com
Wed Nov 23 07:12:14 PST 2011


I have a question regarding printing documents from WebKit/Gtk webview:

In short: is it possible to reload content of the webview when the printing 
dialog is accepted but before the actual printing begins?

To elaborate it little more: I have added my own tab to the GTK Printing 
dialog (via GtkPrintOperation's "create-custom-widget" signal) where user can 
adjust some details regarding content of the printed document (specifically, 
user can choose which email headers he/she wants to print). 

When user accepts the dialog, WebKit prints what is currently displayed in it, 
but I need to actually reload the webview before printing so that the headers 
user had chosen to print are generated and included in the printout.

I tried to to call webkit_webview_reload() from "begin-print" handler, but 
since the reload happens asynchronously, I am unable to do proper paging (the 
reloaded content may be longer and require more pages the the old one).

I suppose that WebKit has to re-render the content anyway, to apply 
media="print" stylesheet so is there any way I could let WebKit to re-fetch 
the document completely?

Thanks for any ideas.

Best regards,
Dan Vratil

dvratil at redhat.com | Evolution developer
GPG Key: 0xC59D614F6F4AE348
Fingerprint: 4EC1 86E3 C54E 0B39 5FDD B5FB C59D 614F 6F4A E348

More information about the webkit-gtk mailing list