Add PDF bookmarks with Ghostscript post.
[blog.git] / posts / PDF_bookmarks_with_Ghostscript.mdwn
diff --git a/posts/PDF_bookmarks_with_Ghostscript.mdwn b/posts/PDF_bookmarks_with_Ghostscript.mdwn
new file mode 100644 (file)
index 0000000..af22b97
--- /dev/null
@@ -0,0 +1,22 @@
+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
+using [Ghostscript][], following [maggoteer's post][post] to the
+Ubunto forums.  The syntax is:
+
+    $ gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=out.pdf in-*.pdf pdfmarks
+
+Where `out.pdf` is the generated PDF, `in-*.pdf` are the input PDFs,
+and `pdfmarks` is a text file with contents like:
+
+    [/Title (Title Page) /Page 1 /OUT pdfmark
+    [/Title (Table of Contents) /Page 3 /OUT pdfmark
+    ...
+
+Nice and easy.
+
+[pdftk]: http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
+[Ghostscript]: http://ghostscript.com/
+[post]: http://ubuntuforums.org/showthread.php?t=1545064
+
+[[!tag tags/tools]]
+[[!tag tags/linux]]