0

I am trying to build a simple texfile, which holds just pdf's in it and has a table of contents, which refers to the specific page. The title of the section / subsection shall not be shown and the pdf's shall stay in original size. So it is supposed to be a simple TOC for navigating through the pdf's. The problem is, that the TOC does not hyperref to the proper page.

\documentclass[11pt,a4paper]{report}

\usepackage[german]{babel}
\usepackage[utf8]{inputenc}

\usepackage[left=2.5cm,right=2.5cm,top=2cm,bottom=4cm]{geometry}
\usepackage{tocbasic}
\usepackage{pdfpages}
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

\begin{document}

% --- FIRST PDF ---
\addcontentsline{toc}{section}{PDF1}
\includepdf[noautoscale=true]{path/pdf1.pdf}

% --- TOC ---
\tableofcontents
\newpage

% --- PDF2 ---
\addcontentsline{toc}{section}{pdf2}
\includepdf[pages={1-2}, noautoscale=true]{path/pdf2.pdf}

% --- PDF3+4 ---
\addcontentsline{toc}{section}{Title}
% --- PDF3 ---
\addcontentsline{toc}{subsection}{pdf3}
\includepdf[pages={1}, noautoscale=true]{path/pdf3.pdf}

% --- PDF4 ---
\addcontentsline{toc}{subsection}{pdf4}
\includepdf[pages={1}, noautoscale=true]{path/pdf4.pdf}

\end{document}

When i compile the code, TOC hyperrefs the first pdf right, the other TOC hyperrefs are linked to wrong pages. Pagenumbers in the TOC are given properly though. Hope my problem is understandable. Any help appreciated!

1 Answer 1

1

I solved the problem by adding \phantomsection before I used \addcontentsline.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .