Discussion:
[Docutils-users] rst2html link to given page in pdf document
Alan Bromborsky
2014-06-06 14:40:30 UTC
Permalink
I wish to link to a given page in a pdf document from the html document
generated by rst2html:

The following works (in the rst file) - :download:`GA
<../LaTeX_docs/GA.pdf>`
to open GA.pdf at the beginning.
The following does not work - :download:`GA <../LaTeX_docs/GA.pdf#page=12>`
to open GA.pdf at page 12. However if I use - :download:`GA
<../LaTeX_docs/GA.pdf>`
in the rst file and then change - _downloads/GA.pdf
in the html file to - _downloads/GA.pdf#page=12
then the link does open on page 12. Do you know of anyway to code this
directly in the rst file?
David Goodger
2014-06-06 21:52:42 UTC
Permalink
Post by Alan Bromborsky
I wish to link to a given page in a pdf document from the html document
The following works (in the rst file) - :download:`GA
<../LaTeX_docs/GA.pdf>`
to open GA.pdf at the beginning.
The following does not work - :download:`GA <../LaTeX_docs/GA.pdf#page=12>`
to open GA.pdf at page 12. However if I use - :download:`GA
<../LaTeX_docs/GA.pdf>`
in the rst file and then change - _downloads/GA.pdf
in the html file to - _downloads/GA.pdf#page=12
then the link does open on page 12. Do you know of anyway to code this
directly in the rst file?
What does ":download:`URL`" do? I've never seen that before.

Putting "#page=12" into the RST source ought to work fine, and it
would if it were a simple link (without the :download: part, e.g. just
"`GA <../LaTeX_docs/GA.pdf#page=12>`_". This produces the following
HTML:

<a class="reference external" href="../LaTeX_docs/GA.pdf#page=12">GA</a>

Please show us the HTML output you get, when you include that parameter.
--
David Goodger <http://python.net/~goodger>
David Goodger
2014-06-06 23:12:37 UTC
Permalink
Post by David Goodger
Post by Alan Bromborsky
I wish to link to a given page in a pdf document from the html document
The following works (in the rst file) - :download:`GA
<../LaTeX_docs/GA.pdf>`
to open GA.pdf at the beginning.
The following does not work - :download:`GA
<../LaTeX_docs/GA.pdf#page=12>`
Post by David Goodger
Post by Alan Bromborsky
to open GA.pdf at page 12. However if I use - :download:`GA
<../LaTeX_docs/GA.pdf>`
in the rst file and then change - _downloads/GA.pdf
in the html file to - _downloads/GA.pdf#page=12
then the link does open on page 12. Do you know of anyway to code this
directly in the rst file?
What does ":download:`URL`" do? I've never seen that before.
Putting "#page=12" into the RST source ought to work fine, and it
would if it were a simple link (without the :download: part, e.g. just
"`GA <../LaTeX_docs/GA.pdf#page=12>`_". This produces the following
<a class="reference external" href="../LaTeX_docs/GA.pdf#page=12">GA</a>
Please show us the HTML output you get, when you include that parameter.
Note that my rst file is processed with python-sphinx.
I can't help you with Sphinx-specific markup ("download"), sorry. Perhaps
ask on the Sphinx list.
The rst text and the resulting html output is shown below
rst html
`GA <../LaTeX_docs/GA.pdf>`
Note that you need a trailing underscore for this to work. See my example
above.
:download:`GA <../LaTeX_docs/GA.pdf>` <a
class="reference download internal" href="_downloads/GA.pdf"><tt
class="xref download docutils literal"><span
class="pre">GA</span></div>:download:`GA <../LaTeX_docs/GA.pdf#page=12>`
<tt class="xref download docutils literal"><span class="pre">GA</span>
Юрий Кудряшов
2014-06-06 21:51:18 UTC
Permalink
Post by Alan Bromborsky
I wish to link to a given page in a pdf document from the html document
The following does not work - :download:`GA
<../LaTeX_docs/GA.pdf#page=12>` to open GA.pdf at page 12.
What exactly do you get in HTML in both cases (working and not working)?
--
Yury G. Kudryashov
mailto: ***@urkud.name

() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Loading...