<html>
<head>
<meta name="generator" content="Windows Mail 17.5.9600.20498">
<style data-externalstyle="true"><!--
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
}
p.MsoNormal, li.MsoNormal, div.MsoNormal {
margin:0in;
margin-bottom:.0001pt;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst, 
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle, 
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
line-height:115%;
}
--></style></head>
<body dir="ltr">
<div data-externalstyle="false" dir="ltr" style="font-family: 'Calibri', 'Segoe UI', 'Meiryo', 'Microsoft YaHei UI', 'Microsoft JhengHei UI', 'Malgun Gothic', 'sans-serif';font-size:12pt;"><div>hi,</div><div><br></div><div>I have the following code which compiles and runs successfully,however no matter what uri I choose I always get the error&nbsp;“There was an error creating the snapshot”. I would please request you to point out the problem with this code.</div><div><br></div><div>Please note that in order to&nbsp;run this code you need to provide a uri argument to webkit_web_view_load_uri.</div><div><br></div><div>I would have not posted this here but I could not find any coding samples or additional documentation&nbsp;available on said topic, other than the API docs.</div><div><br></div><div>thanks.</div><div><br></div><div>#include &lt;webkit2/webkit2.h&gt;<br>#include &lt;gtk/gtk.h&gt;</div><div><br></div><div>static void <br>snapshot_chain_cb(WebKitWebView *web_view,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GAsyncResult* res,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpointer data)<br>{<br>&nbsp;GError * err = NULL ;<br>&nbsp;cairo_surface_t *surface = webkit_web_view_get_snapshot_finish(WEBKIT_WEB_VIEW(web_view),res,&amp;err);<br>&nbsp;if ( err )<br>&nbsp;{<br>&nbsp;&nbsp;printf("We have a problem.Specifically:%s\n",err-&gt;message);<br>&nbsp;}<br>}</div><div><br></div><div>static void <br>cbfunc(WebKitWebView *webview,<br>&nbsp;&nbsp;WebKitLoadEvent load_status,<br>&nbsp;&nbsp;gpointer data)<br>{<br>&nbsp;if ( load_status != WEBKIT_LOAD_FINISHED )<br>&nbsp;&nbsp;return ;</div><div><br></div><div>&nbsp;webkit_web_view_get_snapshot(webview,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WEBKIT_SNAPSHOT_OPTIONS_INCLUDE_SELECTION_HIGHLIGHTING,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (GAsyncReadyCallback)snapshot_chain_cb,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL);<br>}</div><div><br></div><div>int main(int argc,char* argv[])<br>{<br>&nbsp;gtk_init(&amp;argc,&amp;argv);<br>&nbsp;GtkWidget* webview = webkit_web_view_new();<br>&nbsp;GtkWidget* mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);<br>&nbsp;GtkWidget* scrollable = gtk_scrolled_window_new(NULL,NULL);<br>&nbsp;gtk_container_add(GTK_CONTAINER(mainwindow),scrollable);<br>&nbsp;gtk_container_add(GTK_CONTAINER(scrollable),webview);</div><div><br></div><div>&nbsp;webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),"");</div><div><br></div><div>&nbsp;g_signal_connect(webview,"load-changed",G_CALLBACK(cbfunc),NULL);<br>&nbsp;gtk_main();<br>&nbsp;return 0;<br>}<br></div></div>
</body>
</html>