Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Background:

I have a one page document with header information at the top. I would like the document to automatically scrolling past this header when it is opened.

The following theorem is only relevant in case you are wondering why I don't just generate two versions of the document.


Theorem: I should not generate a version without this info (until release).

Proof : This information is extremely relevant to me. So I need to have that there. But, this is really not useful for anyone when they start to review a document. However, once the reviewer wants to provide me feedback, then that information becomes relevant as they need to tell me which version of which document they are commenting on.

Thus this information needs to always be there. QED. :-)


Question:

I am wondering if there is some kind of \hyperset{} call which will tell the PDF reader to open the document, at the \phantomsection labelled start of doc (in the MWE below).

In the references section below is a link to a similar titled question, but I don't see how to use that to open to a particular bookmark. One solution would be to compute the coordinate and use \hypersetup{XYZ=left top zoom}, but wondering if there is an easier way.

The MWE below has a bookmark which if you click on will take you to the spot where I'd like the document to open to automatically.

References:


Code:

\documentclass{article}
\usepackage[paperwidth=6.0in, paperheight=25in]{geometry}
\usepackage{lipsum}
\usepackage{hyperref}

\hypersetup{pdfstartview=FitH}

\begin{document}
This part at the top of the file contain information related to
this file including:
\begin{itemize}
    \item file name,
    \item file version,
    \item edit history,
    \item list of things still to be completed, etc..
\end{itemize}
And this info can be quite long, in a few cases.
So the PDF should open with the following rule at the top.
\hrule\medskip

\phantomsection
\label{start of doc}
\pdfbookmark{Start of Doc}{start of doc}
\textbf{Begin of Actual Document:}

This is the start of the actual document, the info
above can be quite long, so I would prefer that the 
document open to this point in the page.

\bigskip
\textbf{Dummy text to fill page:}
\lipsum[1-8]
\end{document}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

FitH has a parameter for the vertical position that can be calculated using \hypercalcbp. The example uses package zref-savepos for pdfTeX or XeTeX (that support \pdfsavepos) to get the vertical position:

\documentclass{article}
\usepackage[paperwidth=6.0in, paperheight=25in]{geometry}
\usepackage{lipsum}
\AtBeginDocument{%
  \hypersetup{pdfstartview=FitH \hypercalcbp{\zposy{start}sp}}%
}
\usepackage{hyperref}
\usepackage{zref-savepos}


\begin{document}
This part at the top of the file contain information related to
this file including:
\begin{itemize}
    \item file name,
    \item file version,
    \item edit history,
    \item list of things still to be completed, etc..
\end{itemize}
And this info can be quite long, in a few cases.
So the PDF should open with the following rule at the top.
\hrule\medskip

\phantomsection
\zsavepos{start}
\label{start of doc}
\pdfbookmark{Start of Doc}{start of doc}
\textbf{Begin of Actual Document:}

This is the start of the actual document, the info
above can be quite long, so I would prefer that the
document open to this point in the page.

\bigskip
\textbf{Dummy text to fill page:}
\lipsum[1-8]
\end{document}
share|improve this answer
    
Seems as if this does not require the use of \phantomsection, \label, and \pdfbookmark. I had only put them there assuming they were going to be needed. –  Peter Grill Mar 17 '13 at 23:58
    
@PeterGrill Thanks for editing. The bookmark still might be useful for PDF viewers that do not support OpenAction. –  Heiko Oberdiek Mar 18 '13 at 0:12
    
@HeikoOberdiek, Can \zsavepos also save the page information?, such that one can also locate a specific page, (and the use it in combination with hyperref's pdfstartpage options to start the viewer at the right page). –  alfC Sep 10 '13 at 22:05
    
@alfC A page number can be extracted by package refcount and a \label. Or there is zref-abspage. –  Heiko Oberdiek Sep 10 '13 at 22:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.