# How to add bookmarks on PDFs

Submitted by Nicola Rainiero on 2012-06-28 (last updated on 2013-06-19)

The convenience of a good index in printed documents is essential to ensure fast tracking of the desired content, and a rapid overview. In PDF files, however, the situation is different, they are always too slow and uncomfortable, not to mention of their consultation in the ebook reader. So the bookmarks become an unavoidable choice, below I describe how to insert them with LaTeX or with a friendly GUI editor.

Reading and referring to various types of PDF, I noticed how is difficult to search for a particular chapter or section inside them, although some of them have tables of content (alias TOC) well structured. It also happens to have different page numbering, i.e. the first part is numbered with small Roman numerals, while the remainder will start again with the classical Arabic ones. In this way the desired page in the PDF will be burdened by the initial number of pages (in Roman style) and every time you have to point in a specific page, as you read in the TOC, you have to make a sum to reach the right page.

In fact, there are also PDFs with clickable TOCs that solve the problem, but in the eBook reader require a steady hand and finger very small and precise to active the link, therefore they help up to certain point.

The bookmarks fix this problem, they are a sort of clickable TOC callable at any point and any page, as documented by the following two PDF files:

 WITHOUT WITH PDF without bookmarks PDF with bookmarks using LaTeX

And if you want to add or change them? You can do this in two ways: manually using LaTeX or easily using a java software called JPdfBookmarks.

## Insertion using LaTeX

It is sufficient to load pdfpages and hyperref packages and to add the bookmarks like this detailled example:

%
% in \includepdf specifies the pages interval
% and adds addtoc to declare which pages will constitute the bookmarks
% firstly begin inserting in ascending order the pages
% every definition must followed by comma
%
% page number,
% type of sectioning (ie chapter, section, subsection),
% 1,{title of bookmark},
% corresponding label but I don't use it and I type always “a”,
% finally:
5,chapter,1,{Primo capitolo},a,
% …,
% the last bookmark must be without final comma
9,section,1,{II Paragrafo},a
% then closes the insertion, defining between "{" "}" the PDF file name and the path if is different from the TEX file
}]{esempio_x_articolo.pdf}


This will be the final TEX file:

\documentclass{book}
\usepackage[english,italian]{babel}
\usepackage{pdfpages}
\author{Nicola Rainiero}
\title{Esempio di PDF con o senza segnalibri}
\usepackage[pagebackref]{hyperref}
\begin{document}
1,chapter,1,{Copertina},a
}]{esempio_x_articolo.pdf}

\frontmatter
3,chapter,1,{Indice},a
}]{esempio_x_articolo.pdf}

\mainmatter
5,chapter,1,{Primo capitolo},a,
5,section,1,{Introduzione},a,
6,section,1,{II Paragrafo},a,
6,section,1,{III Paragrafo},a,
9,chapter,1,{Secondo capitolo},a,
9,section,1,{I Paragrafo},a,
9,section,1,{II Paragrafo},a
}]{esempio_x_articolo.pdf}

\end{document}


Using pdflatex you can compile a new PDF with bookmarks.

## Insertion with JPdfBookmarks editor

A more versatile and practical solution is provided by an excellent software licensed GPLv3 that allows you to customize the bookmarks with different colors and styles and many other advanced features. The two images below are eloquents:

 Go in the desidered page and click the right button mouse below the bookmarks window: choice the first or second item Type the corresponding bookmark

When you finished, you can save everything in this initial file or in another one. For more information and to learn the advanced features of this software, you can read the documentation in the project site.

## Related Content:

### Nicola Rainiero

A civil geotechnical engineer with the ambition to facilitate own work with free software for a knowledge and collective sharing. Also, I deal with green energy and in particular shallow geothermal energy. I have always been involved in web design and 3D modelling.