On Wed, Nov 17, 2010 at 01:01:52AM +0100, REIDLINGER Wolfgang wrote: > hi evince team; > > i want to write a little pyhon script which will be part of a biger > forensics framework. the script should be able to parse pdf files > and extract the pix out of it. for this reason i want to know how > you implement this function in the evince pdf viewer (r. mouse > > "save picture as")?! may you can show me the part of the code which > is responsible for this function. Evince uses libpoppler to read pdfs. Poppler has a glib interface so you can use it. You can find the code in evince at backend/pdf/ev-poppler.cc to see how evince is doing it. I think this is the function that you're looking for: GdkPixbuf * pdf_document_images_get_image (EvDocumentImages *document_images, EvImage *image) { GdkPixbuf *retval = NULL; PdfDocument *pdf_document; PopplerPage *poppler_page; cairo_surface_t *surface; pdf_document = PDF_DOCUMENT (document_images); poppler_page = poppler_document_get_page (pdf_document->document, ev_image_get_page (image)); surface = poppler_page_get_image (poppler_page, ev_image_get_id (image)); if (surface) { retval = ev_document_misc_pixbuf_from_surface (surface); cairo_surface_destroy (surface); } g_object_unref (poppler_page); return retval; }
Attachment:
signature.asc
Description: Digital signature