You are not logged in.
Hi there!
I want to generate a document where every fourth page comes from document B. The pattern is supposed to be AAABAAABAAAB etc.
How can I do that with pdftk?
Cheers,
Kalsan
Offline
This sounds very much like an X-Y problem. If you don't know how to do it with pdftk, why do you assume it is the write tool for the job? I did just check the man page, and it seems pdftk should be perfectly capable of this ... but then didn't you check the man page. Such goals are covered explicitly there. So what are you looking for?
If you know the length of the files, just do:
pdftk A=infile1.pdf B=infile2.pdf cat A1-3 B1 A4-6 B2 A7-9 B3 ...If you don't know the length before-hand, you need to decide how to deal with files when A is not exactly 3 times as long as B. But you'd just assemble the trailing part of the command in a variable then do the same command. Something like:
cmd=""
for n in {0..$PenultimateBPage}; do cmd="$cmd A$((n*3+1))-$((n*3+3)) B$((n+1))"; done
pdftk A=infile1.pdf B=infile2.pdf cat $cmd"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
Well I was hoping there was an easier way to do that. I know the A1-3 B A4-6 notation, but when a document has several thousand pages, one probably doesn't want to type in that stuff by hand. So I was hoping for an option setting the shuffle behaviour to a specific pattern. According to your answer, this is not possible. I'll write a bash script then.
Thanks for the reply!
Offline