# Adding a cover image to an existing pdf file breaks th links of the original pdf [duplicate]

We have a main.pdf, and a cover image and a tex file. When we use texlive2013 to add the cover image and the contents of the tex file in the main pdf, the links in the main pdf breaks, in the sense the texts that were links are still coming in blue but they are not pointing to anything anymore, they are just normal texts.

Contents of the tex file:

\documentclass[a4paper,11pt]{article}
\usepackage{times,color,graphicx}
\usepackage[final]{pdfpages}
\renewcommand\familydefault{\sfdefault}
\definecolor{covergray}{gray}{0.5}
\usepackage[pdftex,%
pdfstartview=FitH,%
bookmarks=false,%
urlcolor=covergray%
]{hyperref}

\begin{document}

\thispagestyle{empty}%
\setcounter{page}{1}
\parindent=0pt\parskip=0.5pc

\begin{center}\bf
\vfill
\begin{center}
\frame{\includegraphics[height=1.0\hsize]{cover.jpg}}
\end{center}
\vfill
\color{covergray}
Some text
\end{center}
\includepdf[pages=-]{main.pdf}
\end{document}

-

## marked as duplicate by Martin Schröder, Heiko Oberdiek, mafp, T. Verron, ThorstenJun 21 '13 at 9:18

This is well known, I'm not sure if there is any solution to this other than including the cover in the original file in the first place. I saw an explanation about this at some point but don't remember it. –  daleif Jun 20 '13 at 14:11
Welcome to TeX.SX! –  Papiro Jun 20 '13 at 14:12
@daleif: This one? –  Martin Schröder Jun 21 '13 at 8:20
@MartinSchröder, not really it was explaining why hyperrefs got lost. I don't understand much os the inner workings of PDF anyway. –  daleif Jun 21 '13 at 8:30

AFAIK all TeX drivers that can include PDF images strip the annotations from the pages including links.

Workarounds:

• If main.pdf was generated via TeX, then the best strategy would be to add the cover page there to keep the links and outlines in main.pdf.

• There is a project pax (PdfAnnotExtractor) that uses the Java library PDFBox (in an older version) to extract some annotations and a LaTeX package hooks into \includegraphics (used by pdfpages) to insert them afterwards.

• PDFtk can keep some annotations:

pdftk cover.pdf main.pdf cat output new.pdf


but the outlines of main.pdf are lost.

-
sorry for my ignorance, but what is outlines in this context? –  daleif Jun 20 '13 at 14:21
@daleif: Bookmarks. –  Heiko Oberdiek Jun 20 '13 at 15:53
Thanks for the comments. Will try to use pdftk and see if it works. –  Aritra Jun 25 '13 at 9:17