[cairo] Information on cairo's missing support for hyperlinks in the PDF backend

Gabriel Scherer gabriel.scherer at gmail.com
Wed Jun 1 17:56:20 UTC 2016


Hi cairo,

I believe that cairo's lack of support for linking an URI to rendered
objects on the PDF backend has been a long-standing issue among
software projects using Cairo to render PDF files.

This feature has been discussed on the Cairo list or bugtracker several times:

- in 2007, Alp Toker proposed an API with the PDF and XPS backend in mind,
  but no actual implementation work appears to have been done
  https://lists.freedesktop.org/archives/cairo/2007-November/012026.html

- in 2009, Dan McMahill asked about the feature again
  https://lists.cairographics.org/archives/cairo/2009-February/016617.html
  there had been no progress, but Adrian Johnson mentioned that
  a 2008 Cairo summit discussion proposed to instead let people add
  non-graphic PDF objects directly from a cairo render
  https://lists.cairographics.org/archives/cairo/2009-February/016619.html
  It seems that Adrian Johnson started working on this, but I cannot
  find this work in today's Cairo, does anyone know what became of it?

- in 2011, 'Pander' submitted a bug report on the Cairo bugtracker
  https://bugs.freedesktop.org/show_bug.cgi?id=40078
  Adrian Johnson indicated in 2015 that there was interest
  in having the feature for 1.16. I would warmly welcome any
  news on this front.

The question has been asked repeatedly to applications using Cairo as
a backend to render PDFs.
Namely:

- the 2011 bugreport above comes from a feature request on the Graphviz project

- in 2012 the Weasyprint project was asked for support for links in PDF output;
  they initially turned the feature down, then implemented a workaround
  as a post-filtering pass
    https://github.com/Kozea/WeasyPrint/issues/1

- Inkscape has received user requests for preserving hyperlinks in PDF exports,
  and has so far turned them down because of lack of support on Cairo side. See
  https://bugs.launchpad.net/inkscape/+bug/407701
  This bug report was submitted in 2009, and got updates from 6
interested users in
  2011, 2012, 2013, and 2014.
  Finally someone implemented a post-processing script in Python that
is a fragile hack,
  and is hard for users to use (they create a purple rectangle with a
link that the script
  finds and replace by a proper link by postprocessing the PDF)
  https://blog.oxplot.com/add-hyperlink-to-inkscape-pdf/

- Firefox had a feature request in 2008 to preserve hyperlinks in
"print to file" output,
  https://bugzilla.mozilla.org/show_bug.cgi?id=454059
  with three duplicate requests and regular user interest


More information about the cairo mailing list