2

In rst and sphinx, I want to link to an external pdf file after I have created pdf output. I understand that I have to use the :download: directive, e.g.

here is a pdf file :download:`pdf <doc/mypdf.pdf>`

While this works fine generating html output, it does not work for pdfs generated from sphinx (using make pdf or make latexpdf). 'Does not work' means that while the links are shown, the document does not open if I click on the link. It only opens for html links in the document.

I am aware of the question and answer: How to do a link to a file in rst with sphinx? ,

but this does not help me, since this only covers html output.

While I am not sure about rst2pdf, at least Latex should contain directives which allow to include links to pdfs which can be clicked on, e.g. hyperref as described here: https://tex.stackexchange.com/questions/41539/does-hyperref-work-between-two-files/41605#41605

Any ideas? Is this possible at all?


EDIT: With `make latexpdf, links to pdfs such as

:download:`PDF-document <filename.pdf>`

get translated into latex as

\sphinxcode{PDF-document}

\sphinxcode seems to refer to some kind of latex macro, but even with the newest version of Tex live installed, this macro does not get resolved in a way that links would be clickable. Furthermore, the link itself (PDF-document) is already lost in the latex document.


EDIT 2:

A file sphinx.sty gets created by make pdflatex which defines the commands \sphinxincludegraphics (for including images, where the links work) and \sphinxcode (for including pdfs,where the link does not work). I am adding a latex tag to this post, maybe someone there can help to understand the problem.

Community
  • 1
  • 1
tfv
  • 6,016
  • 4
  • 36
  • 67

0 Answers0