Pablog

“Talk is cheap. Show me the code.” - Linus Torvalds

Merging PDF files on OS X (and failing)

I need a place to write down technical stuff, and for now this will be it.

    Here’s what I’d like to do: I’d like to merge several PDF files into one, multi-page PDF file. Simple, right? Seems like something I should be able to do in my favorite way to Get Things Done: from the command line, and with Free Software. And indeed I can, with pdftk.

    Pdftk is a command-line tool for doing everyday things with PDF documents. Keep one in the top drawer of your desktop and use it to:

    • Merge PDF Documents
    • Split PDF Pages into a New Document
    • Decrypt Input as Necessary (Password Required)
    • Encrypt Output as Desired
    • Fill PDF Forms with FDF Data and/or Flatten Forms
    • Apply a Background Watermark
    • Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels
    • Update PDF Metadata
    • Attach Files to PDF Pages or the PDF Document
    • Unpack PDF Attachments
    • Burst a PDF Document into Single Pages
    • Uncompress and Re-Compress Page Streams
    • Repair Corrupted PDF (Where Possible)

    Pdftk allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.

    Wonderful; sounds easy enough. It has a packaged DMG, but the file seems old and contains some odd warnings near it (”this installer does not work on OS X 10.4.0, but it does work on OS X 10.4.1″). Also, I like to build things when I can, so I hop over to the build instructions to find out that OS X users need to build and install gcj in order to build pdftk. Boo. Boo to Apple for not including gcj and boo to pdftk for requiring it.

    While I would normally follow this through to the end, it’s getting late and I’d like to get this done and get to bed. The download page mentioned an alternative app for OS X called Combine PDFs, so I will give that a shot.

    Some rather amusing German translation on the website, but the program seems to be designed for exactly what I want to do. (Written in Realbasic–intriguing.) Ok, standard .app fair installation (i.e. lack thereof), and straightforward GUI. Click “Add Files…” and … what? I can’t select more than one file in the Open Dialog? Curses! Longing for a wildcard, but also for bed, I click the damn button 39 times and grumble about the scrollbars not remembering their positions. Let’s see whether this app will deliver where it counts…

    Beachball… I suppose it is a mac app. I’ll go brush my teeth. After coming back I find the progress bar lost in VirtueDesktops limbo. Understandable; I’m a compulsive desktop flipper–drives anyone who watches me work crazy. Page 14/39…

    Well, even if this works, it’s clear that pdftk might still be worthwhile to get working in the future. I probably won’t get around to it until next time I need to do some PDF task. Hopefully then I won’t start so late at night (or by then OS X Developer Tools will include gcj).

    Aaaand no text made it through. Wonderful. Well, here goes with pdftk then.

    In the interest of sleep I’ll try the dmg first. A nice little Apple Cardboard Box and a readme that lists the files installed. Nice. I think I’ll actually store this readme somewhere in case I ever want to uninstall. Just several dylibs and an executable. Wish I had man pages though. Let’s see how this one does.

    Seems the authors forego man pages for a huge (402 lines) output for –help. Time to try pdftk *.pdf cat output howareyou.pdf verbose

    Output looks good, but PDF gives same problems with text. Opening just Page 1 with Preview reveals the problem. No text shows up there. Photoshop opens the PDF fine, though. Alright. That’s enough for tonight. Zipping up the individual PDF files and uploading them to Viovio. You win, mysterious PDF format… this time.

    Activity

    No comments, leave your comment or trackback.

    Leave a Reply


    Search

    The archives run deep. Feel free to search older content using topic keywords.