Page 1 of 1

simple script for combining pdf files

PostPosted: Fri Sep 16, 2011 8:00 am
by Graf_Wetter
Hi there,

a little help needed for the following problem:

A rule in Hazel watches a folder, where subfolders with several pdf files are dropped in.

FOLDER_A
--- Subfolder "11111" with single pdf files

What I need now is a simple script to be used in this Hazel rule that does just two things:

1. Combine all of the single pdf files of one subfolder to one combined file (ordered by filename)

2a. name the combined file "combined.pdf" and save it in the same subfolder where the single files came from (here: "11111")
OR
2b. name the combined file with the specific subfolder name (here: "11111.pdf") and save it to the parent folder (here: "FOLDER_A")

Hope this is not to hard for someone who is familiar with scripting.
Unfortunately I am not at all.

Thanks a lot.
Greetings form Germany ...

Graf_Wetter

Re: simple script for combining pdf files

PostPosted: Mon Sep 19, 2011 4:22 am
by Graf_Wetter
Hi again,

i found the command line tool "pdftk" to process the pdf files.

example:
pdftk *.pdf cat output combined.pdf

Can I use this inside a "run shell script" action ?
How can I lead pdftk to the dropped in subfolders ("11111") to look for the single files ?

Thanks
Graf_Wetter

Re: simple script for combining pdf files

PostPosted: Mon Sep 19, 2011 11:58 am
by Mr_Noodle
In theory yes, though I don't know enough about the program to say definitively. As for subfolders, there's a sticky article at the top of this forum explaining it.

Re: simple script for combining pdf files

PostPosted: Wed Sep 21, 2011 3:16 am
by Graf_Wetter
Hi,

I made it with an Automator action.
Not very smart, but it works.

If there“s lean script solution out there ... thanks for a short hint.

Graf_Wetter

Re: simple script for combining pdf files

PostPosted: Thu Oct 03, 2013 6:31 am
by scrabble
Graf_Wetter could you post your solution in detail. I don't get it running.