PDF Burst and Staple

I have occasion to deal with PDF scans that contain multiple documents.

sudo apt-get install pdftk

Insert the following into .gnome2/nautilus-scripts/PDF/Burst:

#/bin/bash
name=$(echo $1 | cut -d '.' -f 1)
pdftk $1 burst output ${name}-%03d.pdf

Insert the following into .gnome2/nautilus-scripts/PDF/Staple:

#/bin/bash
pdftk $1/*.pdf cat output $1.pdf

Mark both as executable, and splitting such a document is as easy as burst, create folder, drag and drop, and staple.

Based on the Nautilus Scripts for Subversion.


name=$(echo $1 | cut -d '.' -f 1)

Might be better written as:

name=${1%.*}

That preserves everything up to the last dot.  You can use %% instead to strip off everything as far right as the first dot.

Please excuse me for jumping in.  I know that this matters little now we’re on machines with abundant resources.

Posted by Dominic Mitchell at

[from drbyte] Sam Ruby: PDF Burst and Staple

I have occasion to deal with PDF scans that contain multiple documents, and splitting such a document is as easy as burst, create folder, drag and drop, and staple....

Excerpt from del.icio.us/network/anwarhit at

Dominic: thanks!  Knowing the full range of options available is always goodness.  Continuing on that thought, as far as I can tell, the following:

name=$(echo $1 | cut -d '.' -f 1 | sed "s/ /-/g")

would require two lines using only bash features:

name=${1%.*}
name=${name/ /-/}

Or am I missing something obvious?

Posted by Sam Ruby at

You’re not missing anything. Shell is that limited. (But this case is still simple enough that I’d prefer to stick to the builtin constructs.)

Posted by Aristoteles Pagaltzis at


[from connolly] Sam Ruby: PDF Burst and Staple

[link]...

Excerpt from del.icio.us/network/pwkoolj at

Add your comment












Nav Bar