Skip to main content
gregn92182887
Participant
Oct 15, 2017 9:02 PM UTC
Answered

Help merging tab and chapter pdfs

Hello,

I have a situation where after running a process I have a folder full of pdfs. It can be any number of pdfs but the pattern is the same:

Chapter1_tab.pdf

Chapter1_Text.pdf

Chapter2_tab.pdf

Chapter2_Text.pdf

Chapter3_tab.pdf

Chapter3_Text.pdf

What I need to do is merge the _tab file with the _text file below it. Each pair of files is a chapter in a book. I don't need to do any further merging other than stick the tab at the front of the chapter. I do it manually now but I can have nearly 1000 chapters and tabs. It takes hours. Thanks in advance for any ideas.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Oct 16, 2017 8:19 AM UTC

Use an Action that executes this JavaScript code and run it on your folder:

(function () {

    if (/_text\.pdf$/i.test(this.path)) {

        try {

            this.insertPages({nPage: -1, cPath: this.path.replace(/_text\.pdf$/i, "_tab.pdf")});

        } catch (e) {

            console.println("Error inserting the tab file into: " + this.path);

            return;

        }

        this.saveAs(this.path.replace(/_text\.pdf$/i, "_merged.pdf"));

    }

})();

6 replies

Legend
Oct 15, 2017 10:19 PM UTC

Did you try just Create PDF From Multiple Files (no scripting at all)?

Translate
try67
Community Expert
Community Expert
Oct 15, 2017 9:05 PM UTC

Are those the actual file names? Are they always the same?

What version of Acrobat do you have?

Translate
gregn92182887
Participant
Oct 16, 2017 12:26 AM UTC

Those aren't the actual filenames but they would follow a similar pattern of having identical names before the underscore and then  _tab or  _text.

Basically I need the tab file (which is a one page document) to be inserted as page one of the text file. The result is that I then have a chapter pdf with its corresponding tab as page 1.

As of now I open the chapter document. Then drag the tab file in front of page one. Hit save. Repeat a thousand times.

If there was some way for acrobat to just look at a folder of pdfs  and then combine every two documents I think that would do it.

I'm using acrobat 11

Translate
Bernd Alheit
Community Expert
Community Expert
Oct 16, 2017 5:44 AM UTC

Combine all files in one file and split the chapters with the help of the bookmarks.

Translate