9 Replies Latest reply on Dec 23, 2016 11:57 AM by SpydeyNinja

    How do I, via javascript code, insert multiple corresponding PDFs from one folder to multiple corresponding PDFs in another folder?

    SpydeyNinja

      I could really use some help from some kind soul out there. I have been racking my brain trying to learn this and scouring the forums/internet and have come up empty handed. I have been trying to figure this out for the last 3 months on my own with no success. Could someone please help me?

       

      I have two folders: folder "A" and folder "B".

       

      On any given day they will both have multiple PDFs in them. The number of PDFs will vary from day to day and week to week, but the number of PDFs in both folders will always match on the same day.

       

      i.e. Monday folder "A" could have 15 PDFs and thus folder "B" would have 15 PDFs. Tuesday it could be 3 PDFs in each folder. Friday it could be 1,000 PDFs in each folder. Regardless of the day, there will always be the same number of PDFs in each folder.

       

      I am currently running/using Adobe Pro 8 (not my decision, out of my control/authority) and due to the limited functionality I have to find an alternative/creative way to achieve an end result via a script. At least I hope that it can be done.

       

      When I run the script, I need the PDFs in folder "B" to be inserted into the end of the PDFs in folder "A", but it has to be a 1:1 ratio. Meaning the first PDF in the list in folder "B" needs to be insert into the first PDF in the list in folder "A". Then the second PDF in folder "B" into the second PDF in folder "A", the third into the third, the fourth into the fourth, etc etc. Until the last PDF has been insert from folder "B" into the last PDF in folder "A".

       

      I then also need to save each merged/inserted result separately in a different location but still use the same naming scheme as the PDFs in folder "A".

       

      My initial, very basic thought was something such as this:

       

      -Count the number of PDFs in Folder "A"

      -Count the number of PDFs in Folder "B"

           -Compare to ensure they each have the same number of PDFs (which they always should)

      -Insert B.1 to the end of A.1

      -Save newly merged/created PDF to new location

           -Save newly merged/created PDF using same name as A.1 file

      -Insert B.2 to the end of A.2

      -Save newly merged/created PDF to new location

           -Save newly merged/created PDF using same name as A.2 file

      -Insert B.n to the end of A.n

      -Save newly merged/created PDF to new location

           -Save newly merged/created PDF using the same name as A.n file

       

      I hope that all makes sense.

       

      Is there anyone that can assist me, please? Thank you for your assistance, time, and effort.