Here's what I am trying to do:
I have a large scanned pdf file and I want to make an index page so that I can jump to a given page by clicking on a link. So far, I managed to do that, but I would like to print the page number as well, so that someone with a physical copy can locate a given page. Since there are many entries, I was thinking about somethig like this:
- Entry 1 (p. xx)
- Entry 2 (p. yy)
- Entry 3 (p. zz)
and so on.
I also want to add a red box around the entries so that they show on the pdf file but not on a printed copy. I don't need TOC for the pdf file. Is it possible to do that?
Main code:
\documentclass[12pt,a4paper]{article}
\input{packs.tex}
\title{\Large Fancy title}
\author{\Large Me}
\date{\Large \today}
\begin{document}
\maketitle
Here are some entries...
\begin{multicols}{2}
\begin{foo}[nosep]
\hyperlink{page.2}{Entry 1}
\hyperlink{page.4}{Entry 2}
\hyperlink{page.6}{Entry 3}
\end{foo}
\end{multicols}
\includepdf[pages=-,pagecommand={\thispagestyle{plain}}]{dummy.pdf}
\end{document}
packs.tex:
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{pdfpages}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\makeatletter
\newcommand{\checkForEnd}{\@ifnextchar\end{}{\item}}
\makeatother
\newenvironment{foo}[1][]
{\par\obeylines
\begingroup\lccode`~=`\^^M
\lowercase{\endgroup\let~}\checkForEnd
\begin{enumerate}[#1]}
{\end{enumerate}}
\makeatletter
\let\orig@Hy@EveryPageAnchor\Hy@EveryPageAnchor
\def\Hy@EveryPageAnchor{%
\begingroup
\hypersetup{pdfview=Fit}%
\orig@Hy@EveryPageAnchor
\endgroup
}
\makeatother
\usepackage{hyperref}
And the code to generate a dummy pdf file:
\documentclass{report}
\usepackage{blindtext}
\pagenumbering{gobble}
\begin{document}
\Blinddocument
\end{document}