Interleave merge pdf files

Mark Jackson mjackson at alumni.caltech.edu
Fri Jul 22 13:48:23 EDT 2005


"Chirayu Krishnappa" <chirayuk at gmail.com> writes:
> Hi,
> 
> I need to scan documents with pages having printed matter on both
> sides. It is easiest to stack them in the autosheet feeder and let it
> scan. I end up with one file (say A.pdf) containing the odd pages in
> sequence. Similarly, I can end up with B.pdf containing the even pages.
> I want to combine them into result.pdf which contains A.1, B.1, A.2,
> B.2, A.3, B.3, ... (A.1 = page 1 of A.pdf).
> 
> Does someone know a simple way to achieve this? I noticed the other
> thread on this newsgroup about merging lots of pdf files and
> multivalent tools and pdftk were mentioned. However, I could not find a
> way to do this using them. I am interested in another free tool or a <
> 25 lines python script (which may use any freeware library) to do the
> same.

I face exactly the same problem.  Based on examination of the pdftk man
page I *think* it can be done by something like (untested):

pdftk A.pdf burst output %04d_A.pdf
pdftk B.pdf burst output %04d_B.pdf
pdftk *_?.pdf cat output combined.pdf

assuming fewer than 10,000 pages per document, of course.

I would be interested in an alternative approach which does not
generate a ton of intermediate pdfs.

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
	It is difficult for men in high office to avoid
	the malady of self-delusion.	- Calvin Coolidge





More information about the Python-list mailing list