I was recently trying to add bookmarks to a [[PDF]] I'd generated with
-[pdftk][]. It turns out to be fairly simple to add bookmarks to a PDF
+[[pdftk]]. It turns out to be fairly simple to add bookmarks to a PDF
using [Ghostscript][], following [maggoteer's post][post] to the
Ubunto forums. The syntax is:
I've bundled the whole pdfmarks-generation bit into a script,
[[pdf-merge.py]], which generates the pdfmark file and runs
Ghostscript automatically. Think of it as a bookmark-preserving
-version of pdftk's `cat`. The script uses pdftk internally to extract
-bookmark information from the source PDFs.
+version of pdftk's `cat`. The script uses [[pdftk]] internally to
+extract bookmark information from the source PDFs.
The script also adds a bit of PostScript to ignore any bookmarks in
the source PDFs during the Ghostscript run. The only bookmarks in the
what you want, the script can pause (via `--ask`) to allow you to
tweak the pdfmarks manually before running Ghostscript.
-[pdftk]: http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
[Ghostscript]: http://ghostscript.com/
[post]: http://ubuntuforums.org/showthread.php?t=1545064
[reference]: http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdfmark_reference.pdf
--- /dev/null
+[pdftk][] is a useful tool for manipulating PDFs.
+
+Unfortunately, there's a [bug][] in [[Gentoo's|Gentoo]]
+`app-text/pdftk` package. The build eventually crashes with:
+
+ g++ -DPATH_DELIM=0x2f -DASK_ABOUT_WARNINGS=false -DUNBLOCK_SIGNALS -fdollars-in-identifiers -DPDFTK_VER=\"1.44\" -Wall -Wextra -Weffc++ -O2 -I../java pdftk.cc -c
+ pdftk.cc:60:39: fatal error: com/lowagie/text/Document.h: No such file or directory
+
+Which is due to a bad `-m64` option brought in by `CFLAGS_amd64`:
+
+ gcjh -force --classpath=":/var/tmp/portage/app-text/pdftk-1.44/work/pdftk-1.44-dist/java:." com/lowagie/text/Chunk
+ gcjh: unrecognized option '-m64'
+
+You can successfully install pdftk with:
+
+ CFLAGS_amd64="" emerge -av pdftk
+
+[pdftk]: http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
+[bug]: https://bugs.gentoo.org/show_bug.cgi?id=254463