I have a code.ps file converted to code.pdf , which I want to add to the end of every page in my test.pdf , i.e shrink the test.pdf's every page and add an image to the end of it .
I have written the following shell script to it , but it appends the code.pdf as a new page after every page of test.pdf ! ...Kindly help . Here is my code :-
#!/bin/sh
filename=test.pdf
pages="`pdftk $filename dump_data | grep NumberOfPages | cut -d : -f2`"
numpages=`for ((a=1; a <= $pages; a++)); do echo -n "A$a B1 "; done`
pdftk A=$filename B=code.pdf cat $numpages output $filename-alternated.pdf
exit 0
pdftk
has astamp
(orbackground
option) - but it simply overlays the two pdfs. I would usepdfjam
to preprocess the test.pdf (scale and offest) andpdftk
to compose them. This would require only two lines of code (three if code.pdf has to be preprocessed as well) and no loops. – Phonography