TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I add a Table of Contents (TOC) to an existing PDF?

I have an existing PDF (scanned notes from a class). I'd like to improve this basic scan as much as possible. I do not think that any OCR is good enough to recognize handwriting, so I cannot make it searchable. But I would like to manually modify it by adding a TOC in the beginning that links to parts of the document.

One way could be to split the PDF into separate documents, then have:

\section{Part One}
\section{Part Two}

But I am wondering if there is a way to do this without splitting it up.

share|improve this question
@gull there is already an accepted answer so I think the posters problem was solved in 2011. – dustin Aug 12 '13 at 10:12
up vote 31 down vote accepted

use package pdfpages and then:


\addcontentsline{toc}{section}{The first section name}% or chapter
\addcontentsline{toc}{section}{The second section name}% or chapter
\addcontentsline{toc}{section}{The third section name}% or chapter
\addcontentsline{toc}{section}{The forth section name}% or chapter

share|improve this answer
Interesting/disappointing that pdfpages' linktotoc option is harder than just doing this manually, since the rest of the package is excellent. – Will Robertson Feb 14 '11 at 21:35
@Will do you mean addtotoc? – mankoff Feb 14 '11 at 21:58
@Herbert Thank. It sort-of works. It appears correct, but the TOC links (and sidebar links) all go to the bottom of the local TeX text document. (page 2, after the TOC and title page). The TOC link says "page 17", but just jumps to the bottom of the local doc (the top of all the included pages). – mankoff Feb 14 '11 at 22:12
@mankoff: I edited the answer. There is now a working example. – Herbert Feb 14 '11 at 22:25
@mankoff — yes, sorry. My brain confused linktodoc and addtotoc. – Will Robertson Feb 14 '11 at 23:55

Your Answer


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.