No more poppler_page_render_to_pixbuf() in Ubuntu 12.04



Hi,


I used the code below to render a page of a pdf to a scrolled window in
a gtk application of mine. After downloading Ubuntu 12.04 I get that
there is no more support for poppler_page_render_to_pixbuf(). I do know
that we are supposed to use cairo.  But how?  How do I replace the code
below with cairo?  What are we supposed to use, total cairo or
gdk_cairo_create().  

The code below pulls pdf data with poppler, creates a gdkpixbuf, renders
it to the pixbuf, and then puts it in a scrolled window.  I cannot find
an "ample" example that would fit my requirements.  Any help is
appreciated, I have been hacking for about 2 days now. 



scrolledwindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object (builder,
"pdfscrollview"));
   
total_pages = poppler_document_get_n_pages(doc);
if(page_num > total_pages) page_num = 0;
page = poppler_document_get_page(doc, page_num);
poppler_page_get_size(page, &width, &height); 
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, width, height);


\\depreciated line!!!
poppler_page_render_to_pixbuf(page, 0, 0, width, height, 1, 0, pixbuf);


image = gtk_image_new_from_pixbuf(pixbuf);
viewport = gtk_bin_get_child(GTK_BIN(scrolledwindow));
if(viewport ) gtk_container_remove(GTK_CONTAINER(scrolledwindow),
viewport);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW
(scrolledwindow), image);


Craig Bakalian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]