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

Automate merge pdf files

Community Beginner ,
Apr 20, 2021 Apr 20, 2021

Copy link to clipboard

Copied

We are looking to automate a task to merge two pdf files each with the same number of pages, into one pdf file in a specific order, not adding one file to the end of another. We want to create one pdf file from the two pdf files by putting each page of the second pdf file after each page of the first pdf file. A1, B1, A2, B2, A3, B3 etc. It seems an easy task, but with 100 pages manually moving one at a time is possible, but not really a good use of time, and prone to errors if the operative isnt concentrating.

One option might be to export each page in each file to a separate 1 page doc, Doc A to 1,3,5,7,9 etc, and Doc B to 2,4,6,8,10 and then import one after the other back in to one file.

other than that I need to find some way of zippering it together by page number.

Any pointers would be appreciated.

TOPICS
Create PDFs , Edit and convert PDFs , How to , JavaScript

Views

1.8K

Translate

Translate

Report

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 ,
Apr 20, 2021 Apr 20, 2021

Copy link to clipboard

Copied

Search the forum for:

merge odd even pages

Votes

Translate

Translate

Report

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Thankyou will take a look

Votes

Translate

Translate

Report

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
Advisor ,
Apr 20, 2021 Apr 20, 2021

Copy link to clipboard

Copied

Hello,

 you can create the an Action Wizard Action adding in the Exacute Javascript tool with the below code pasted into the tools window. I tested and it does exactly what you're looking to do.

 

Below is the post where this was found and copied from.

https://community.adobe.com/t5/acrobat-sdk/code-to-merge-two-pdfs-of-scanned-book-one-of-odd-pages-t...

 

// create an array to use as the rect parameter in the browse for field

    var arRect = new Array();

    arRect[0] = 0;

    arRect[1] = 0;

    arRect[2] = 0;

    arRect[3] = 0;

    // create a non-visible form field to use as a browse for field

    var f = this.addField("txtFilename", "text", this.numPages - 1, arRect);

    f.delay = true;

    f.fileSelect = true;

    f.delay = false;

    // user prompted to select file to collate the open document with

    app.alert("Select the PDF file to merge with")

    // open the browse for dialog

    f.browseForFileToSubmit();

    var evenDocPath = f.value;

    var q = this.numPages;

    var t = app.thermometer;

    t.duration = q;

    t.begin();

    // insert pages from selected document into open document

    for (var i = 0; i < q; i++) {

        var j = i * 2;

        this.insertPages(j, evenDocPath, i);

        t.value = i;

        t.text = 'Inserting page ' + (i + 1);

    }

    t.end();

    // remove unused field

    this.removeField("txtFilename");

 

Regards,

Mike

Votes

Translate

Translate

Report

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

LATEST

Thankyou

will give this a go today

Votes

Translate

Translate

Report

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