I know I can use `hyperref` with the 'pageanchor' option (already
enabled by default) and then `\hyperlink{page.5}{Link to page 5}` to
link to e.g. page 5 (logical page 5 not the physical one). However
this jumps to the page anchor at the top left of the page and still
uses the current zoom level.
Some other similar commands like `\href` or `\bookmark` ('bookmark'
package) support the `page` option which links to the page itself
(using absolute page numbers starting from 1). These links display the
page then using full-page zoom level, which is what I want. However `
\href` requires an URL and there seems to be no real way to tell it
that it is a document local page. Using `\jobname.pdf` isn't really an
option because it breaks as soon the PDF is renamed. It seems to be
supported by the PDF file format, because `\bookmark` supports it.
Any ideas? This admittedly specific feature might simply not be
implemented by hyperref yet. IIRC `\href[page=..]{..}` is also
relatively new.
> I like to have a hyperlink to a specific page in the document which
> displays the full page when clicked.
>
> I know I can use `hyperref` with the 'pageanchor' option (already
> enabled by default) and then `\hyperlink{page.5}{Link to page 5}` to
> link to e.g. page 5 (logical page 5 not the physical one). However
> this jumps to the page anchor at the top left of the page and still
> uses the current zoom level.
This is controlled at anchor setting time, the page anchor is set at
page shipout time:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\hyperlink{page.1}{Link to page 1},
\hyperlink{page.2}{Link to page 2 (Fit)},
\hyperlink{page.3}{Link to page 3}.
Page 1
\newpage
\begingroup
\hypersetup{pdfview=Fit}
Page 2
\newpage
\endgroup
Page 3
\end{document}
> Some other similar commands like `\href` or `\bookmark` ('bookmark'
> package) support the `page` option which links to the page itself
> (using absolute page numbers starting from 1). These links display the
> page then using full-page zoom level, which is what I want. However `
> \href` requires an URL and there seems to be no real way to tell it
> that it is a document local page.
The data pair \thepage and \value{page} is only available in TeX and
it is not stored in the PDF file. A small exception is the /PageLabels
entry that could be examined.
> Using `\jobname.pdf` isn't really an
> option because it breaks as soon the PDF is renamed. It seems to be
> supported by the PDF file format, because `\bookmark` supports it.
>
> Any ideas? This admittedly specific feature might simply not be
> implemented by hyperref yet. IIRC `\href[page=..]{..}` is also
> relatively new.
A full support of the PDF features for links is quite complex,
there are many action types and even nested actions are
possible.
In package `bookmark' I have implmented more possibilities
than hyperref provides. The data are set by a key value interface. But
the user interface is not too user-friendly. For example, the
question, which data are needed for which action, is not too clear.
However the feedback is quite sparse, especially there aren't
any suggestions for a more user-friendly interface.
--
Heiko Oberdiek
Thanks for explaining that the view option must be set at link
creation time.
I think my issue could be fixed by making all page anchor use the
`Fit` view.
As I see the code this can be achieved by patching \Hy@EveryPageAnchor
to contain a local \hypersetup{pdfview=Fit}:
\documentclass{article}
\usepackage{hyperref}
\usepackage{lipsum}
\makeatletter
\let\orig@Hy@EveryPageAnchor\Hy@EveryPageAnchor
\def\Hy@EveryPageAnchor{%
\begingroup
\hypersetup{pdfview=Fit}%
\orig@Hy@EveryPageAnchor
\endgroup
}
\makeatother
\begin{document}
\hyperlink{page.5}{Page 5}
\lipsum[1-30]
\end{document}
Maybe a `pagenachorview` setting which allows the user to set the
`pdfview` for the the `pageanchor`s would be useful?
Best Regards,
Martin