From: Rui Maciel on
Florian Diesch wrote:

> If you just want to add PDF bookmarks:
> <http://www.florian-diesch.de/software/pdfrecycle/>

That appears to do the trick. After browsing the documentation I believe that the
PAGE feature works at least to some extent. I don't believe it supports section
nesting but it does mark links to pages in the "contents" section, which is a good
start.


Thanks in advance,
Rui Maciel
From: Florian Diesch on
Rui Maciel <rui.maciel(a)gmail.com> writes:

> Florian Diesch wrote:
>
>> If you just want to add PDF bookmarks:
>> <http://www.florian-diesch.de/software/pdfrecycle/>
>
> That appears to do the trick. After browsing the documentation I believe that the
> PAGE feature works at least to some extent. I don't believe it supports section
> nesting but it does mark links to pages in the "contents" section, which is a good
> start.

To set bookmarks you use the MARKx statement (where x is the nesting
level starting from 0 (top level). If you omit the level it defaults to
0.

The PAGE statement tells pdfrecycle which pages to include. Marks are
always set on the first page of the next PAGE statement.


So e.g.

--8<---------------cut here---------------start------------->8---
FILE some_file.pdf

MARK Title
PAGE 1

MARK First section
PAGE 2

MARK1 A subsection
PAGE 3-5

MARK2 Another level
PAGE 6

MARK1 This page has two marks
MARK2 at different levels
PAGE 7

MARK everything else
PAGE 8-
--8<---------------cut here---------------end--------------->8---


creates the following bookmarks:

--8<---------------cut here---------------start------------->8---
Title (on page 1)
First section (on page 2)
A subsection (on page 3)
Another level (on page 6)
This page has two marks (on page 7)
at different levels (on page 7)
everything else (on page 8)
--8<---------------cut here---------------end--------------->8---


Florian
--
<http://www.florian-diesch.de/software/pdfrecycle/>
From: Robert Komar on
Rui Maciel <rui.maciel(a)gmail.com> wrote:
> Is there an application for linux that lets the user add a custom table of contents
> to a PDF? It would already be great if it was possible to add shortcut links to
> pages.
>
> So, is there anything capable of doing that?

It looks like you already got one solution, but if you're still
interested, google for "pdfmarks gs". You can use ghostscript
to add nested bookmarks (shortcut links?) to a pdf file. I do
it often and it works great.

Here's a simple bookmarks template:

[ /Title (BOOKTITLE) /Author (THEAUTHOR) /DOCINFO pdfmark
[ /Page 12 /View [/XYZ 0 842 1.0] /Title (CHAPTERTITLE) /Count 1 /OUT pdfmark
[ /Page 14 /View [/XYZ 0 842 1.0] /Title (SECTIONTITLE) /OUT pdfmark
[ /Page 20 /View [/XYZ 0 842 1.0] /Title (Appendices) /Count 3 /OUT pdfmark
[ /Page 20 /View [/XYZ 0 842 1.0] /Title (APPENDIXA) /OUT pdfmark
[ /Page 21 /View [/XYZ 0 842 1.0] /Title (APPENDIXB) /OUT pdfmark
[ /Page 22 /View [/XYZ 0 842 1.0] /Title (APPENDIXC) /OUT pdfmark
[ /Page 30 /View [/XYZ 0 842 1.0] /Title (Index) /OUT pdfmark
[ /PageMode /UseOutlines /DOCVIEW pdfmark

The bookmarks are the lines with /OUT (outline) in them. You'd change
the page numbers and the stuff inside the parentheses (). Of course,
you can add more bookmarks, and have multiple levels of nesting by adding
the /Count directive to each nested parent bookmark. Save them to a file
(say 'pdfmarks'), and then convert your original 'nomarks.pdf' to
'withmarks.pdf' using the command:

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=withmarks.pdf nomarks.pdf pdfmarks

I personally don't add a custom table of contents (the bookmarks seem a
better way to do this), but if you wanted to, you could probably do it
by adding a list of annotations (/ANN) via pdfmarks.

Cheers,
Rob Komar