1

I am trying to add a table of contents to a collection of pdfs I have joined to a single pdf to submit for an application. (I used pdf arranger for this)

I have added a first page with the contents, however I would like to add internal links to the pages of each document. My question is similar to Add links in PDF which unfortunately has no answers. However, I do not have acrobat and would preferably like to use a free, available for linux solution for the task.

2 Answers 2

2

You can prepare a suitable bookmarks.txt or bookmarks.json file, and then use cpdf -set-bookmarks bookmarks.txt in.pdf -o out.pdf or cpdf -set-bookmarks-json bookmarks.json in.pdf -o out.pdf as appropriate. A bookmarks.txt file might look like this:

0 "Part 1" 1 open
1 "Part 1A" 2
1 "Part 1B" 3
0 "Part 2" 4
1 "Part 2a" 5

The format details are in the manual, linked from https://community.coherentpdf.com/

2

Ended up using latex to create the table of contents... @johnwhitington's solution looks simpler, so I set this as the answer, but I was pretty happy with the pdf i created... Here is a simplification of the latex code used...

\documentclass{article}
\usepackage{blindtext}
\usepackage[a4paper]{geometry}
\usepackage[final]{pdfpages}
\usepackage{sectsty}
\usepackage[hidelinks]{hyperref}
\sectionfont{\centering}

\begin{document}

\pagenumbering{gobble}

\section*{Documents Index:}

\begin{center}\begin{tabular}{c p{38em}}
        \hyperref[anx:1]{Annex 1:}& \hyperref[anx:1]{This is a title} \\
        \hyperref[anx:2]{Annex 2:}& \hyperref[anx:2]{And another }\\
        \hyperref[anx:3]{Annex 3:}& \hyperref[anx:3]{And so on... }\\
......
\end{tabular}\end{center}

\newpage

{\phantomsection}\label{anx:1}
\includepdf[pages=1]{ev.pdf}
{\phantomsection}\label{anx:2}
\includepdf[pages=2]{ev.pdf}
{\phantomsection}\label{anx:3}
\includepdf[pages=3]{ev.pdf}
.........
\includepdf[pages=11-]{ev.pdf}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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