1

Lets say I have 100 PDFs in one folder1 (filename: 1, 2,3,4..) and another 100 PDF in another folder2 (Filename: 1,2,3,4...). Now I want to combine PDF1 in folder1 with PDF1 in folder2 and so on till pdf100 from folder1 is combined with pdf100 in folder2.

The PDF in folder 1 shoudl be placed in the first page of the pdf1 in folder2. (this applies for all the pdf)

How can this be implemented? Can we use data merge? Will Photoshop be useful or indesign or acrobat reader?

7
  • I'm thinking that I would make an indesign script that combines the pdf files it to single document in order, export that to pdf and then use the split feature in Acrobat to split the pdf every 2 pages. (It could be done straight from indesign, but I feel this would be simpler).
    – Joonas
    Oct 13, 2015 at 9:11
  • HI joonas, thanks for the reply..the problem is, folder1 is just a one page jpeg image in pdf format and folder2 has 100 pdf's with different page numbers...If you think you have a simpler method to combine..please let me know..the main idea is to add the jpeg pdf to each pdf in folder2
    – mohad
    Oct 13, 2015 at 9:23
  • Your explanation is a bit confusing. I'm still not entirely sure what the situation is. It sounds like before you were saying both folders had 100 pdfs and now it sounds like you're saying that first folder has 1 file and second folder has 100.
    – Joonas
    Oct 13, 2015 at 9:33
  • If both folders have same amount of files another method comes to mind. You could use either a script or an application to rename the files separately. For example, Better Rename 9 has Sequence Numbers naming feature, which allows you to change the step value. With it, you could rename the files in the first folder to; 1, 3, 5, 7... and files in the second folder to: 2, 4, 6, 8..., by changing the start number to 2. After that you'd just put the files in the same folder and use the Combine feature + the split feature in acrobat.
    – Joonas
    Oct 13, 2015 at 9:34
  • Hi mohad, welcome to GDSE and thanks for your question. If you want to know more about the site, please see the help center or ping one of us in the Graphic Design Chat once your reputation is sufficient (20). Keep contributing and enjoy the site!
    – Vincent
    Oct 13, 2015 at 9:57

1 Answer 1

1

You can do this, but your asking on wrong forum. Youd much more likely get a good answer on superuser than here. Merging PDF files isn't exactly a magic science.

Tools that would come handy:

  • Acrobat DC Pro,as a gui tool for merging pdf files but then you'd have to run it 100 times. Can also be scripted to do this, but the scripting environment is a bit horrible (some info here). I would make a demo but i havent got acrobat DC at home (yeah i arrived took me nearly the whole trip to craft the original message).
  • PDF Fill
  • PDF-Xchange, has a gui tool for merging pdf files but then you'd have to run it 100 times.
  • Scripting language like python with pyPDF
  • Indesign
  • GhostScript
  • pdfunite
  • Batch scripting
  • ...

Currently im writing this over on my phone and I'm a bit low on tools. So I'm going to show how to do this with python and pyPdf (because all I have on my phone is bash, tcsh, zsh and python. Aside the browser which implements javaScript).

#!/usr/bin/python
# -*- coding: utf-8 -*-

from pyPdf import PdfFileWriter, PdfFileReader

for i in range(1,101):
    output = PdfFileWriter()
    outputStream = file("output%d.pdf"%i, "wb")
    for item in [r"folder1\file%d.pdf"%i,r"folder2\file%d.pdf"%i]:
        fp = file(item,'rb')
        input = PdfFileReader(fp)
        output.addPage(input.getPage(0))
        output.write(outputStream)
        fp.close()

if you have got python but not pyPdf then run pip install pyPdf or easy_install pyPdf before running the script.

3
  • You could also mention pdfsam as free platform independent option. Too bad that python syntax highlighting is not available here :)
    – p2or
    Oct 13, 2015 at 15:08
  • @poor well python is paltform independent. I did a quick count of applications that could do this with less than 20 lines of scripting on my work computer and i came up with a staggering count of 120 applications/tools that could do this.
    – joojaa
    Oct 13, 2015 at 15:13
  • AFAIK pdfsam is written in java, but does a solid job IMO.
    – p2or
    Oct 13, 2015 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.