Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Re: problem in shell script to merge PDF fils

Please don't take this the wrong way but you can achieve a huge amount
with the opensource gui based pdfsam which is GPL'd I think, I use it
all the time and love it. It takes care of a lot of your challenges
without a single line of scritping :-)



On 19 Feb, 10:28, pe...@xxxxxxxxxxxxxxxxxx wrote:
> >>>>> "Chris" == Chris Allen <chris.h.al...@xxxxxxxxx> writes:
> Chris> I need to merge several sets of PDF files into a single PDF
> Chris> file For example want to merge the files
> spaces in file names are difficult to handle, especially when you have
> multiple levels of quoting.
> Chris> To make life easier I created the following shell script
> Chris> #bash echo echo $0 echo $1.pdf echo \"$2\"* echo echo gs
> Chris> -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$1.pdf
> Chris> \"$2\"* echo gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite
> Chris> -sOutputFile=$1.pdf \"$2\"*
> That needs to be "$2" withput the backslashes.
> I'd actually want to do something like:
> #!/bin/sh
> output="$1"
> shift
> gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite  -sOutputFile="$output" "$@"
> and list all the filenames (properly quoted) on the command line to
> the script, thus:
>         pdfmerge outfile.pdf "a .b.c .pdf" "foo bah .pdf"
> etc
> In general, I'd avoid file names with spaces or tabs in them.  There
> are too many badly-written scripts in the wild that will do the wrong
> thing with them.
> Peter C
> --
> Dr Peter Chubb  http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.auhttp://www.ertos.nicta.com.au ;         ERTOS within National ICT Australia
> --
> SLUG - Sydney Linux User's Group Mailing List -http://slug.org.au/
> Subscription info and FAQs:http://slug.org.au/faq/mailinglists.html