Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Community Beginner ,
Dec 23, 2016 Dec 23, 2016

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.

TOPICS
Acrobat SDK and JavaScript , Windows
953
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 23, 2016 Dec 23, 2016

JavaScript is deliberately very limited. In particular it cannot scan folders, so the project is a non-starter. This could be done in visual basic using the Acrobat SDK.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2016 Dec 23, 2016

I think it can be done using scripts, actually, but it would have to be a multi-step process that uses Actions to scan the folders and a script to perform the actual merge.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2016 Dec 23, 2016

@Test Screen Name & try67

The scanning of the folders to compare the number of PDF files is really not that crucial. It was just an idea of mine. They will always have the same number of files, so that is a given.

Do you think there is a way to take the the files and merge them as I indicated in my op? How would I go about doing that without having to manually go one by one? Any ideas?

Thanks for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2016 Dec 23, 2016

If the file names are not always the same then they will have to be

scanned, either way.

On Fri, Dec 23, 2016 at 6:42 PM, SpydeyNinja <forums_noreply@adobe.com>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2016 Dec 23, 2016

So the file names are the same in the sense that folder "A" will always have the file name starting with same prefix. Same for the files in folder "B". The names do change though depending on how many PDFs are in the folder.

An example:

Folder A:

A_001, A_002, A_003, .......... A_099, etc etc.

Folder B:

B_001, B_002, B_003, .......... B_099, etc etc.

So the file names do change depending on the number of files there are, but they always start with the same prefix.

So I guess that yes, they will have to be scanned to determine the number of files to know the ending point, correct?

Does Adobe Pro 8 have Actions? I thought that was only in Adobe X & Adobe XI?

What are the first steps to getting this setup?

Thanks for your time and assistance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 23, 2016 Dec 23, 2016

Not just the number of files, but also their names. But if the names are identical in both folders then a single scan action is sufficient.

Acrobat 8 Pro has this feature, yes, it's called Batch Processing.

As I mentioned, this is a complex, custom-made task. I can guide you in general how to do it, but if you want me to create it for you then you can contact me privately and we could discuss the details, including the price.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2016 Dec 23, 2016

Oh, ok, Batch Processing. I actually use it for a number of things, including some scripts to extract individual documents from merged PDFs. But I don't think I have done anything as advanced and/or in depth as what I am trying to do.

Question for you, what kind of a process would this be known as? Would it or something similar to this be called by a specific name? Not just insert or merge, but something specific to what I am trying to do?

I ask so that I can have something to go off of for researching. If I can find something similar to this then perhaps I can learn from it and adapt it to what I need. It is worth a shot, right.

I will have to think contacting you for the details and see if I have any other options. Thanks Try67!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 23, 2016 Dec 23, 2016

If they are, without exception, numbered, you could in theory do this in one piece of code. You would keep trying to open NAMEnumber until it failed, trapping the failure with a try...except. Then you are done.

In current Acrobat this will probably fail around 100 files because of "security enhancements" but it might just work in Acrobat 8 for up to a few hundred.

I notice in your original message that you've been scouring the forums/internet. One thing Acrobat programmers find is that they usually need to do something new and won't find anything to copy. So the critical resource for all programmers with Acrobat is the Acrobat SDK. Which is to say, the documentation.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2016 Dec 23, 2016
LATEST

Hey, thank you very much for the pointers and info regarding the Acrobat SDK. I will have to take a look at it and will probably need to start learning more of the ins and outs.

Here's me, keeping my fingers crossed to hopefully find something and/or learn how to do it via the Acrobat SDK.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines