Skip to main content
gregn92182887
Participant
October 15, 2017
Answered

Help merging tab and chapter pdfs

  • October 15, 2017
  • 2 replies
  • 520 views

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 has been closed for replies.
Correct answer try67

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"));

    }

})();

2 replies

Legend
October 15, 2017

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

try67
Community Expert
Community Expert
October 15, 2017

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

What version of Acrobat do you have?

gregn92182887
Participant
October 16, 2017

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

Bernd Alheit
Community Expert
Community Expert
October 16, 2017

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