[webkit-gtk] how to trigger load_uri() to actually execute

Henning Sprang henning.sprang at gmail.com
Sat Aug 2 14:10:48 PDT 2014


I'm totally new to Webkit and GTK programming, anf playing around with
a PDF writing functionality,
and I'm mostly there.

The code below actually does it - the problem being that the call to
is opening an actual print dialog window, which I don't need.

But without, the PDF is only 1k because the the URI isn't actually
loaded - the status is
<enum WEBKIT_LOAD_PROVISIONAL of type WebKitLoadStatus>
while, when calling the print_() method, afterwards the status is

I guess there's some signal to make the engine actually load the url
as it's not loaded until it's actually needed somewhere, which happens
automatically in the interactive print functionality, but not in
print_full() for some reason.
But I don't really find out what I can do to trigger that. I tried to
call a view.show(), view.show_all() - but no result. Ah, I also tried
to sleep a while in between to wait for the load, but also no effect.
I also tried to create and load a request explicitly, but same effect,
it's only loaded provisionally.

Thanks for any pointers


here the code:

from gi.repository import Gtk, Gdk, WebKit
from time import sleep

view = WebKit.WebView()

request = Webkit.


frame = view.get_main_frame()

print frame.get_load_status()


print frame.get_load_status()

operation = Gtk.PrintOperation()
frame.print_full(operation, Gtk.PrintOperationAction.EXPORT)

Henning Sprang

More information about the webkit-gtk mailing list