[webkit-gtk] Rendering HTML from JavaScript

Anatoly Zaretsky anatoly.zaretsky at gmail.com
Wed Oct 29 14:33:17 PDT 2014


I am migrating a WebKit1-based application to the WebKit2 API. The
used the WebKitWebView's "window-object-cleared" signal and the
C API to extend the window object with the function

    void renderHTML(String content, String baseURI, Callback

When called the function would:
- create a new WebKitWebView;
- place it inside a newly created GtkOffscreenWindow;
- load the supplied content with webkit_web_view_load_string;
- subscribe to the view's "notify::load-status" signal;
- get the pixbuf from the GtkOffscreenWindow on WEBKIT_LOAD_FINISHED;
- finally, invoke the contentRendered callback passing it the contents
of the extracted pixbuf (particular pixbuf representation used is not
of interest here).

Is it possible to do the same with WebKit2? In particular can a web
process extension use webkit_web_view_new/webkit_web_view_load_html?
The reference manual does not explicitly forbid doing so, though including
both <webkit2/webkit2.h> and <webkit2/webkit-web-extension.h> in the
same source forces compilation error.

Also, are there other ways to programmatically convert some arbitrary
html text into an image?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20141029/89002b83/attachment.html>

More information about the webkit-gtk mailing list