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 ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
rsvg_handle_render_cairo not rendering text path.
I am using librsvg-2-2 with libcairo-2 on a win32 system. I have used Inkscape to create a sample SVG file containing several graphics elements. (Attached) Only the text on path does not render. help please. Regards Derek Noffke GlassButton.svg Description: Binary data ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: No more poppler_page_render_to_pixbuf() in Ubuntu 12.04
Hello. > 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(). I can see 2 different ways of dealing with this API removal. To reuse as much existing code as possible, you can create cairo_image_surface_t, let poppler render your page there using poppler_page_render() and write your own function that will convert between cairo_image_surface_t and GdkPixbuf. Another way would involve replacing GtkImage widget with GtkDrawingArea and drawing your page directly from expose-event/draw signal handler. Details will depend on whether you'll use GTK+-2 or GTK+-3. Cheers, Tadej -- Tadej Borovšak blog.borovsak.si tadeb...@gmail.com tadej.borov...@gmail.com ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list
Re: No more poppler_page_render_to_pixbuf() in Ubuntu 12.04
Hi Tadej; Yes, I finally came up with the following, page = poppler_document_get_page(doc, page_num); poppler_page_get_size(page, &width, &height); cairo_surface_t *s; cairo_t *cr; s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cr = cairo_create(s); poppler_page_render(page, cr); pixbuf = gdk_pixbuf_get_from_surface(s, 0, 0, width, height); image = gtk_image_new_from_pixbuf(pixbuf); with a build in GTK+-3. I just don't understand why there was a depreciation of the older code. Who makes these decisions? Craig Bakalian On Sun, 2012-04-29 at 01:36 +0200, Tadej Borovšak wrote: > Hello. > > > 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(). > > I can see 2 different ways of dealing with this API removal. To reuse > as much existing code as possible, you can create > cairo_image_surface_t, let poppler render your page there using > poppler_page_render() and write your own function that will convert > between cairo_image_surface_t and GdkPixbuf. > > Another way would involve replacing GtkImage widget with > GtkDrawingArea and drawing your page directly from expose-event/draw > signal handler. Details will depend on whether you'll use GTK+-2 or > GTK+-3. > > Cheers, > Tadej > > ___ gtk-list mailing list gtk-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-list