Site Map - skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


The passing of FiftyOneFifty

It is with deep sadness we announce that another of our hosts and friends Donald Grier, known to us as FiftyOneFifty, has passed away.

FiftyOneFifty's frat brother Randy Hall has written an lovely piece. The team at Linuxlugcast are preparing our own tribute if you want to contribute an audio file you can email Honkeymagoo or join the show.

Our thoughts go out to his friends and family at this difficult time.


hpr2667 :: Create PDF bookmarks with Pdftk

Basic intro to a few pdftk functions

<< First, < Previous, Latest >>

Hosted by klaatu on 2018-10-23 is flagged as Clean and is released under a CC-BY-SA license.
Tags: pdf.
Listen in ogg, spx, or mp3 format. | Comments (3)

Pdftk is a command that lets you manipulate PDFs outside of a GUI PDF creation tool. There are several GUI tools you can use to create PDFs with valid bookmarks and other fancy features, but pdftk is often more convenient.

Extract pages 1 through 2, and pages 5-21, and page 261 from a big PDF into a new PDF:


$ pdftk big.pdf cat 1-2 5-21 261 output small.pdf

Extract bookmarks from original PDF:


$ pdftk big.pdf dump_data output book.mark

Here is what a bookmark file looks like:


InfoBegin
InfoKey: ModDate
InfoValue: D:20181010181951-05'00'
InfoBegin
InfoKey: CreationDate
InfoValue: D:20181010181934-05'00'
InfoBegin
InfoKey: Creator
InfoValue: pdftk (Linux)
InfoBegin
InfoKey: Producer
InfoValue: pdftk 2.02-x86_64
PdfID0: d8deadbeeff34211ba60d80fda7611da
PdfID1: 39186170c6134566884b79c0ffee7d59
NumberOfPages: 261
BookmarkBegin
BookmarkTitle: Cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Credits
BookmarkLevel: 1
BookmarkPageNumber: 2
BookmarkBegin
BookmarkTitle: Chapter One
BookmarkLevel: 1
BookmarkPageNumber: 3
BookmarkBegin
BookmarkTitle: Foo Section
BookmarkLevel: 2
BookmarkPageNumber: 5
BookmarkBegin
BookmarkTitle: Bar Baz
BookmarkLevel: 3
BookmarkPageNumber: 7
BookmarkBegin
BookmarkTitle: Back cover
BookmarkLevel: 1
BookmarkPageNumber: 19

Apply the bookmark data back to the PDF:


$ pdftk small.pdf update_info book.mark output final.pdf

Comments

Subscribe to the comments RSS feed.

Comment #1 posted on 2018-10-23T18:09:38Z by b-yeezi

gcj deprecated

It's a shame that PDFtk is basically going away because the GCJ runtime has been deprecated by most major distros. PDFTK still lives on as a Snap. Also, there is a fork that uses openJDK instead. You can reference this Stack Overflow post:

https://askubuntu.com/questions/1028522/how-can-i-install-pdftk-in-ubuntu-18-04-bionic

Comment #2 posted on 2018-10-24T00:59:02Z by Clinton Roy

debian

I'm rather confused about why there's a reliance on any particular java runtime, but at least on debian, if i request pdftk to be installed, pdftk-java is installed, and yeah, no screwing around required.

Comment #3 posted on 2018-10-31T09:18:23Z by Klaatu

Thanks for the snap tip

I install and use pdftk on Slackware, so far without any issue. It's good to know about its availability in snap packages, though...just in case.

<< First, < Previous, Latest >>

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?
Are you a spammer →
Who hosted this show →
What does HPR mean to you ?