ipython/ipython — pull request #4130 by jsw-fnal (2013-08-29 01:25:25+00:00)
Title: PDF figures as links from png or svg figures

I've implemented a feature that I've wanted for a while. When a figure is displayed, the img is a link to a PDF version of the figure. This follows the convention for webpages in my collaboration, where a figure should be displayed on the webpage as a raster, but a vector (eps or pdf) needs to be available for people to use in LaTeX.

To do this, I made four changes. First, I added a PDFFormatter class to formatters.py, and registered it as a formatter. Then, I changed pylabtools.py to always generate PDF output, whether `figure_format` is "png", "svg", or "retina". I think this part still needs some work, as it is currently not configurable. Then, I made jsonutil.py detect and encode PDF data in base64. Finally, I added the necessary javascript to outputarea.js to wrap the anchor tag around the img tag.

I have not tested how this interacts with nbconvert, because my system does not have Haskell available. I have to convince the sysadmins that I really need it before I can try to set up pandoc. So I may need some assistance in that regard.

I hope that this new feature is helpful and can eventually make it into ipython.
Best regards,
Jon