Join Multiple PDF files to a Single One on Mac

By ET

I downloaded an ebook, it contains hundreds of one-page pdf files. I certainly don’t want to upload all of these one-pagers to my Kindle. To concatenate these files, there is no simply and easy way. Commercial software packages are available from $14.00 to 20Euro.

A simply perl hack does the job:

  1. Install the perl module:
    perl -MCPAN -e 'install("PDF::Reuse")'
  2. Create a perl program, call it “catpdf.pl”:

    use strict;
    use PDF::Reuse;

    prFile(“output.pdf”);

    for(@ARGV) {
    prDoc($_);
    }

    prEnd();

  3. To concatenate, call it in two possible ways:
  • perl catpdf.pl a.pdf b.pdf, or
  • perl catpdf.pl *.pdf

————–

As a side note, it is really easy to concatenate mp3 files on mac, just do:
cat *.mp3>output.mp3

  1. 1
    Wei Says:

    Hi this is cool! :)

    By the way, there is a free GUI tool to join PDF files called PDFSAM, available on Windows, Mac, Linux, etc.

    The cat tip is also cool. Didn’t know that. Looking forward to more of these tips. :) (I am using both Windows and Red Hat Enterprise Linux.)

    Share a PDF tip: Some PDF files have extremely small font, especially those behavioral and psychological journal papers. What I do is to crop out the white borders before I print to get human readable font (by a Windows software).

  2. 2
    ET Says:

    nice PDF tip. what software is that?

    fortunately my Kindle DX automatically crops the borders.

  3. 3
    Wei Says:

    The Windows software is Foxit PDF Phantom.
    In my opinion it can replace Acrobat Pro for most purposes.
    It’s still in its 1.0 stage. In the future it probably will include the PDFSAM functions we want.
    (The current version can also work under WINE emulator in Linux.)

  4. 4
    ET Says:

    en, adobe acrobat pro is way too bloated, taking almost 1GB space.

    I installed Foxit PDF before in my virtual windows machine on the mac, just to replace Acrobat Reader, it’s cool if it can replace acrobat pro too.

  5. 5
    ET Says:

    yet another way to concatenate mp3 files:
    http://mpgedit.org

    After installing the commandline, just type:
    mpgedit -o output.mp3 -e- *.mp3

Leave a Reply


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2010. All rights reserved.
All trademarks property of their owners.