[poppler] pdf2svg

Bob Tennent rdt at cs.queensu.ca
Sat Mar 8 10:01:18 PST 2014


I'm using this little program from

http://www.cityinthesky.co.uk/opensource/pdf2svg/

to convert PDF pages to SVG images. The key steps are as follows:

    // Open the SVG file
    surface = cairo_svg_surface_create(svgFilename, width, height);
    drawcontext = cairo_create(surface);

    // Render the PDF file into the SVG file
    poppler_page_render(page, drawcontext);
    cairo_show_page(drawcontext);

For my purposes, this works well, with one exception: clickable
links in the PDF page are not converted into links in the SVG image.
I'm hoping to implement this.

SVG supports simple xlinks and cairo has a function
cairo_surface_set_mime_data with CAIRO_MIME_TYPE_URI as a supported
mime type. I believe links on a PDF page are available using
poppler_page_get_link_mapping.

Am I going in the right direction?  Is there an easier
way?

Bob T.


More information about the poppler mailing list