<!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. But how? 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>
        GtkWidget *viewport, *window, *hpane, *entry;<BR>
GtkScrolledWindow *scrolledwindow;<BR>
        GError* err = NULL;<BR>
        GString *link;<BR>
        gchar *uri;<BR>
        window = GTK_WIDGET(gtk_builder_get_object (builder, "window"));<BR>
        link = make_ly_extension_into_pdf();<BR>
        uri = g_filename_to_uri(link->str, NULL, NULL);<BR>
        g_string_free(link, TRUE);<BR>
        doc = poppler_document_new_from_file(uri, NULL, &err);<BR>
        total_pages = 0;<BR>
        width = 0.0;<BR>
        height = 0.0;<BR>
        if(doc!= NULL)<BR>
        {<BR>
                scrolledwindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object (builder, "pdfscrollview"));                 <BR>
                hpane = GTK_WIDGET(gtk_builder_get_object(builder, "ly_pdf_hpane"));<BR>
                total_pages = poppler_document_get_n_pages(doc);<BR>
if(page_num > total_pages) page_num = 0;<BR>
page = poppler_document_get_page(doc, page_num);<BR>
                poppler_page_get_size(page, &width, &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), "motion_notify_event", G_CALLBACK(motion_notify), image);<BR>
                g_signal_connect(G_OBJECT(viewport), "button-press-event", G_CALLBACK(mouse_down), image);<BR>
gtk_paned_set_position(GTK_PANED(hpane), 500);<BR>
                window = GTK_WIDGET(gtk_builder_get_object (builder, "window"));<BR>
entry = GTK_WIDGET(gtk_builder_get_object (builder, "Entry"));<BR>
                gchar *my_string = g_strdup_printf("%i", page_num + 1);<BR>
                gtk_entry_set_text(GTK_ENTRY(entry), my_string);<BR>
                gtk_widget_show_all (window);<BR>
        }<BR>
}
</BODY>
</HTML>