<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.1.92">
</HEAD>
<BODY>
Hi,<BR>
<BR>
I used the code below to render a page of a pdf to a scrolled window in a gtk application of mine.<BR>
After downloading Ubuntu 12.04 I get that there is no more support for poppler_page_render_to_pixbuf().<BR>
I do know that we are supposed to use cairo.&nbsp; But how?&nbsp; How do I replace the code below with cairo?<BR>
<BR>
these are global variables<BR>
<BR>
static PopplerDocument *doc;<BR>
static PopplerPage *page;<BR>
GdkPixbuf *pixbuf;<BR>
GtkWidget *image;<BR>
<BR>
void open_pdf_file_on_lily_complete()<BR>
{<BR>
&nbsp;         GtkWidget *viewport, *window, *hpane, *entry;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GtkScrolledWindow *scrolledwindow;<BR>
        GError* err = NULL;<BR>
        GString *link;<BR>
        gchar *uri;<BR>
        window = GTK_WIDGET(gtk_builder_get_object (builder, &quot;window&quot;));<BR>
        link = make_ly_extension_into_pdf();<BR>
        uri = g_filename_to_uri(link-&gt;str, NULL, NULL);<BR>
        g_string_free(link, TRUE);<BR>
        doc = poppler_document_new_from_file(uri, NULL, &amp;err);<BR>
        total_pages = 0;<BR>
        width = 0.0;<BR>
        height = 0.0;<BR>
        if(doc!= NULL)<BR>
        {<BR>
&nbsp;                 scrolledwindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object (builder, &quot;pdfscrollview&quot;));        &nbsp;         <BR>
&nbsp;                 hpane = GTK_WIDGET(gtk_builder_get_object(builder, &quot;ly_pdf_hpane&quot;));<BR>
                total_pages = poppler_document_get_n_pages(doc);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(page_num &gt; total_pages) page_num = 0;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; page = poppler_document_get_page(doc, page_num);<BR>
                poppler_page_get_size(page, &amp;width, &amp;height);                <BR>
                pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);<BR>
                poppler_page_render_to_pixbuf(page, 0, 0, width, height, 1, 0, pixbuf);<BR>
                image = gtk_image_new_from_pixbuf(pixbuf);<BR>
                viewport = gtk_bin_get_child(GTK_BIN(scrolledwindow));<BR>
                if(viewport ) gtk_container_remove(GTK_CONTAINER(scrolledwindow), viewport);<BR>
                gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW (scrolledwindow), image);<BR>
                viewport = gtk_bin_get_child(GTK_BIN(scrolledwindow));<BR>
                gtk_widget_add_events(viewport, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK);<BR>
                g_signal_connect(G_OBJECT(viewport), &quot;motion_notify_event&quot;, G_CALLBACK(motion_notify), image);<BR>
                g_signal_connect(G_OBJECT(viewport), &quot;button-press-event&quot;, G_CALLBACK(mouse_down), image);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_paned_set_position(GTK_PANED(hpane), 500);<BR>
                window = GTK_WIDGET(gtk_builder_get_object (builder, &quot;window&quot;));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; entry = GTK_WIDGET(gtk_builder_get_object (builder, &quot;Entry&quot;));<BR>
                gchar *my_string = g_strdup_printf(&quot;%i&quot;, page_num + 1);<BR>
                gtk_entry_set_text(GTK_ENTRY(entry), my_string);<BR>
                gtk_widget_show_all (window);<BR>
        }<BR>
}
</BODY>
</HTML>