I need to merge several sets of PDF files into a single PDF file
For example want to merge the files
-rwx------ 1 chris chris 503392 2009-01-24 08:39 beryl callegher
rvcp induction pg1.pdf
-rwx------ 1 chris chris 909434 2009-01-24 08:39 beryl callegher
rvcp induction pg2.pdf
representing page 1 & 2 of the same certificate for Beryl Callager.
into the file
-rw-r--r-- 1 chris chris 1124611 2009-02-15 13:16
beryl.callegher.induct.pdf
representing the whole certificate for Beryl
I have learnt ow to do this via ghost script with the following command
$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite
-sOutputFile=beryl.callegher.induct.pdf "beryl callegher rvcp ind"*
As a one off job that is not too much work, but I need to do something
similar with several other sets of "pages 1, 2 & 3" for different people
/ certificates
To make life easier I created the following shell script
#bash
echo
echo $0
echo $1.pdf
echo \"$2\"*
echo
echo gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$1.pdf \"$2\"*
echo
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$1.pdf \"$2\"*
and tried to execute same with
$ ./join.pdfs beryl.callegher.induct "beryl callegher rvcp ind"
the echo statements produced
./join.pdfs
beryl.callegher.induct.pdf
"beryl callegher rvcp ind"*
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite
-sOutputFile=beryl.callegher.induct.pdf "beryl callegher rvcp ind"*
The last of these echo's is the displays the correct command.
If I copy and paste that to the terminal it works fine.
But when the script runs the same command, (just after the last echo)
it fails with the following out put
Error: /undefinedfilename in ("beryl)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval--
--nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1150/1684(ro)(G)-- --dict:0/20(G)-- --dict:92/200(L)--
Current allocation mode is local
Last OS error: 2
it produces the following (almost empty) file
-rw-r--r-- 1 chris chris 2160 2009-02-16 20:23
beryl.callegher.induct.pdf
I'll admit to being confused. Can any one explain it?
Regards
Chris Allen
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html