Skip navigation
Currently Being Moderated

Combining an even pages file and an odd pages file into one PDF achieving propper order

Feb 20, 2008 9:26 AM

Hello all!

I have several documents that were scanned (in another application) using an autofeed scanner yielding one file for all frontpages (odds) and one file for all backpages (evens). I have these two files in PDF with comments on them. I would like to be able to combine the two files and achieve the right page ordering without doing it manually. Is there any way or script that may do this? I.e. insert page 1 from evens.pdf after page 1 from odds.pdf, page 2 from 2 (or 4 in real document) from evens.pdf after page 2 (3) in odds.pdf and so on?

Any advice on how to achieve this while retaining comments on both documents will be greatly appreciated.

Sincerly;

Santiago
 
Replies
  • Currently Being Moderated
    Feb 20, 2008 9:35 AM   in reply to (Santiago_Gonzalez_Arriola)
    This can be easily accomplished through Visual Basic using the InsertPages method.

    You can find information about that in the Interapplication Communication API Reference document included with the Acrobat SDK under the section "AcroExch.PDDoc".

    You can find all the relevant documentation here:
    http://www.adobe.com/devnet/acrobat/?navID=documentation
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 20, 2008 9:37 AM   in reply to (Santiago_Gonzalez_Arriola)
    Read this:
    http://www.planetpdf.com/developer/article.asp?ContentID=collating_pdf s_using_javascrip&rhs_fa
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 20, 2008 9:41 AM   in reply to (Santiago_Gonzalez_Arriola)
    Bernd's answer is certainly better for a scripting beginner.

    Gotta love German efficiency.
     
    |
    Mark as:
  • Currently Being Moderated
    Jun 2, 2009 8:51 AM   in reply to Bernd Alheit

    Hi Bernd, thanks for posting this.  Can you explain where to place the script?  Sorry--my first time around with this.  The site says to use the Javascript Debugger...  not just create this as a script?

     

    Thanks

    JP

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 2, 2009 9:27 AM   in reply to Jon E P

    You can execute the code in the Javascript Debugger.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 15, 2009 7:52 AM   in reply to (Santiago_Gonzalez_Arriola)

    There is a simple application I wrote, which provide a solution for that
    problem exactly. It is completly free, although you are more than

    welcome to donate in the site :-)

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 30, 2009 7:52 PM   in reply to (Santiago_Gonzalez_Arriola)

    I've attached a script that adds two menu items into the "Tools" menu. "Collate" merges even and odd pages, and "Reverse" will as reverse the order of the pages in a PDF.

     

    To install it, exit Acrobat. Save the script into Acrobat's Javascripts directory (e.g. C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Javascripts ), and restart Acrobat.

     

    I hope you find this script useful!

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated

    OK, I JUST FIGURED OUT HOW TO DO THIS

     

    Adobe Acrobat X Pro (may work with others also)

     

    File

    Create...

    From Scanner...

    Black and White (or another option)

     

    Now scan the pages you have in order (pages 1,3,5,7.....)

    when you are done it will give you three options

    1. done

    2. continue with more pages

    3. continue with reverse sides

     

    Select the third option to add the reverse sides of the pages.

    Place the stack of papers to start from the last page first, and press scan again.

     

    It will place the pages in the appropriate section of the document.

    Hope this helps.  Good luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 28, 2011 11:24 PM   in reply to jbaitis
    1. CollatePages.js (1.9 K)

    was downloaded and placed in the following folder:

    C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\Javascripts

    It worked as described by “JBAITIS”.

    Had to open first  the PDF file having ODD pages, in Acrobat9.

    Next from “TOOLS”  selected “COLLATE”.

    After a brief error message,  the name of the second PDF file having all EVEN pages was selected.

    Clicked OK and done!

    NB: for “COLLATE” to work you have to open a PDF file first, preferably the odd-pages PDF file.

    Thank you “JBAITIS” for a GREAT and essential time-saver program, and thank you all.

    Dan

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2011 10:43 AM   in reply to dan-hariton

    Here is the latest version of this script, compabible with Acrobat X. The functions have been moved into the "Edit" menu because there is no tools menu in Acrobat X. It still maintains compatibility with Acrobat 9. Unfortunately, you'll have to manually copy and paste this into a file because Adobe has disabled the file attachment feature on Jive Forums.

    // Complements: Planet PDF (http://www.planetpdf.com/)

    // Modified by Jeff Baitis for Acrobat 9 and Acrobat X compatibility

    // Improved Collate function with status bar.

     

    // Add a menu item to reverse all pages in the active document

    app.addMenuItem({  cName: "Reverse", cParent: "Edit", cExec: "trustedReversePages();",  cEnable: "event.rc = (event.target != null);", nPos: 0 });

    // Add a menu item to collate with another document on the filesystem

    app.addMenuItem({  cName: "Collate", cParent: "Edit", cExec: "trustedCollatePages();",  cEnable: "event.rc = (event.target != null);", nPos: 0 });

     

    trustedReversePages = app.trustedFunction(function()

    {

      app.beginPriv(); // Explicitly raise privileges

      var t = app.thermometer;

      t.duration = this.numPages;

      t.begin();

      for (i = this.numPages - 1; i >= 0; i--)

      {

        t.value = (i-this.numPages)*-1;

        this.movePage(i);

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

      }

      t.end();

      app.endPriv();

    })

     

    // Collating pages

    /*

      Title: Collate Document

      Purpose: User is prompted to select document to insert/collate.

      Author: Sean Stewart, ARTS PDF, www.artspdf.com

    */

     

    trustedCollatePages = app.trustedFunction(function()

    {

      app.beginPriv(); // Explicitly raise privileges

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

      app.endPriv();

    })

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 31, 2011 9:42 AM   in reply to jbaitis

    jbaitis's js file is an Excellent job, if I may!

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 14, 2011 6:18 PM   in reply to jbaitis

    This js file is exactly what I needed but I'd like to added it the batch processing function.  unfortunately when i copy the script and put it into the js sequence, it appears to run successfully but after i select the file to add, nothing happens.  any ideas?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 27, 2012 11:12 AM   in reply to jbaitis

    Wowie wow! This is what I've been pulling my hair out over for ages! Thank you so much for this JavaScript script. It works wonderfully and since I just wrote up a file for myself on installing and using it on a Mac, I thought I'd just copy/paste it here for other Mac users who are using Acrobat Pro X and need to collate their files. Hope this helps other Mac users:

     

    So, for Macintosh users, there are Two Big Steps:

     

    Big Step 1:

    The CollatePages.js file has to be placed in

    ~/Library/Application Support/Adobe/Acrobat/10.0/JavaScripts

    folder. To create the file, you can simply copy the script above then paste it into Textedit (make it a plain text file). See important note 2 below for naming it.

     

    Five Important Notes:

    1. If you can't see the Library folder, then in the Finder, use the Option Key to select the Go menu: the home Library folder appears, which will get you into the home library folder that is normally not visible.
    2. At least for Acrobat X Pro, it can be copied and pasted into a file unaltered and it works without a problem. It doesn't really matter what the file is called just be sure to name it as a .js file, not as a .txt file.
    3. Be aware that an upgrade may make the file go away or no longer be read from the 10.0 folder! You can tell it's gone when the Collate & Reverse commands are missing under the Edit menu:CollateCmdAcrobat.png
    4. If installing after an upgrade, then it's likely the folder '10.0' will have changed. The important note is to get the file into the JavaScripts folder that Acrobat Pro reads on startup. I'm saying that here because Acrobat Pro XI is (soon to be) out so it's likely the folder will change.
    5. Last, be sure to enable JavaScripts in Acrobat Pro itself: Under Acrobat -> Preferences, scroll down in the left Categories column to JavaScript (click that). On the right side under JavaScript, be sure the first two items: "Enable Acrobat JavaScript" and "Enable menu items JavaScript execution privileges" are both checked.

     

    Big Step 2:

    In Acrobat Pro, you collate two files: The odd pages file needs to be already open and the even pages file is opened using the Collate command (now under Edit in the menubar as the picture in Note 3 above shows). The file that gets added (presumably the even pages) gets interweaved with the first (already open) file starting at the second page.

     

    If you have separate files for each page (either because they were scanned in separately or they were extracted within Acrobat to separate files) then you first need to combine them into one file for odds and evens.

     

    The Reverse command simply reverses the page order of the open file; possibly helpful if a source file has its pages in the opposite order before collating.

     

    Last, you could, if you want to, click on Yes (this was helpful) below.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 21, 2013 7:35 PM   in reply to jbaitis

    jbaitis, your script is exactly what I've been looking for.  Do you have paypal as I'm feeling the need to make a small monetary contribution.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 21, 2013 9:33 PM   in reply to earthmag

    Hi Earthmag!

     

    Thank you for offering to contribute. May I request that you contribute to some of my favorite software-related organizations:

     

    • Software in the Public Interest ( spi-inc.org )
    • Free Software Foundation ( fsf.org )
    • FreeBSD Project ( freebsd.org )

     

    or any allied academic institution? That would be the best way of saying "thanks" with $$$ that I can think of! :-)

     

    Please note that I am not the original author of either of the scripts -- I merely made them a little easier to install and to use.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 22, 2013 11:50 PM   in reply to (Santiago_Gonzalez_Arriola)

    Not to knock on Adobe, but until they figure out that this function is needed (this thread has been around for 4 years, do they read these things), you can use this:

    http://sourceforge.net/projects/pdfsam/files/pdfsam/2.2.2/pdfsam-x64-v 2_2_2.msi/download

     

    It does exactly what you are asking for, and it is free.  Once it is open, select "alternate mix".

     

    There are many other functions too.

     

    Adobe, if you are reading this, please compile your programs for Linux to please.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2013 12:41 PM   in reply to jbaitis

    Thank you for this, but unfortunately I cannot get it to work with Acrobat XI Standard. I can't believe that Adobe still hasn't made this a feature.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2013 2:01 PM   in reply to Mark Cramer

    Did you look at the Planet PDF solution? For Acrobat X and XI you need to install the per

      

     

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 5, 2013 2:49 PM   in reply to GKaiseril

    Thank you, GKaiseril! Yes, I looked at the Planet PDF solution but was unable to get it to work. The link you gave says that the new location for the JS is going to be Users\(username)\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaSc ripts, however, after C:\Users\Mark\AppData\Roaming\Adobe\Acrobat I have no folder called "Priviledged". I turned on "Hidden Items". Maybe this is because I have Windows 8, I'm not sure. I can get to C:\Users\Mark\AppData\Roaming\Adobe\Acrobat\11.0 but there's no "Priviledged" folder there either. Nor is there any "JavaScripts" folder. I don't know where to go from here.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 8:45 AM   in reply to Mark Cramer

    You can run the code using the JavaScript console for a one time use.

     

    Open the odd pages PDF.

    Open the JavaScript Console, "Ctrl + J.

    Copy and paste the revised script to the console window.

    Select all the text in the console window.

    Use the Ctrl + Numeric Keypad Enter key to run the code.

     

    You should now have the new menu options until you restart Acrobat.

     

    I would move the code to add the menu items to after the creation of the trusted functions.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 10:24 AM   in reply to GKaiseril

    Thank you again, GKaiseril. This is a bit frustrating. Ctrl+J does not open the JavaScript Console. I took a look at http://acrobatusers.com/tutorials/javascript_console and it says that you can also get there using Advanced>JavaScript>Debugger, but I can't find the "Advanced" menu item either. I'm running Adobe Acrobat XI v11.0.2 if that helps. Any other ideas?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 10:35 AM   in reply to Mark Cramer

    Almost all the menu items moved to the TOOLS button in Acrobat X. So JavaScript options are there for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 11:51 AM   in reply to Test Screen Name

    I found the Tools button, but there is nothing there relating to JavaScript. I have "content editing", "pages", "interactive objects", "forms", "text recognition" and "protection". I've clicked on all of them and there is nothing. I also found a Common Tools button but there is nothing there either.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 12:26 PM   in reply to Mark Cramer

    Above those tools, and below the Tools button, is a little icon. I can't describe it, but you should be able to find it. Click on it and you'll see you can turn on a whole lot more options (it will list Content Editing, Pages, etc. with a tick).

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 6, 2013 2:10 PM   in reply to Test Screen Name

    Thank you again. I'm getting close to giving up here, however. I found the JavaScript button which has a button "Set document actions". When I press it I get a box that says, "When this happens..." with options like "Document will close" and "Document will save." I opened up a couple of them and pasted in the JS and tried to run it, but nothing happened.

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2013 4:33 PM   in reply to Mark Cramer

    @Mark Cramer

     

    Did you ever get the script to work?  I have been reading the trail of your efforts and need to do the same thing.  If you have any updates could you post? Or if Gkaiseril or Test Screen Name have additional comments or directions they would be appreciated, 

     

      Thank you

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2013 4:40 PM   in reply to krazykat10

    @krazykat10 - Unfortunately I was never able to get it to work. I tried all of the suggestions above and then monkeyed around with it a bit more before giving up.

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2013 8:29 AM   in reply to Mark Cramer

    You can not just cut and paste the text for many reasons.

     

    Like the old joke about the IBM repairman the walks to the computer. He runs his hand over the side of the computer. Pulls a hammer out of his tool box and taps the side of the computer.

     

    The IS manager says, "I could have that!"

     

    To which the repairman states "It is not in hitting the computer, it is knowing where to hit the computer!".

     

    If the scripts are installed in the directory needed by your version and not necessarily the one in the article.

     

    Also one cannot use Word for editing the text.

     

    If you want more help more specific information is needed as to what exactly is not working, any pop up warnings, and any JavaScript errors.

     

    One of the scripts adds a menu option, so you need to install that script in the "JavaScript" folder for the version of Acrobat that you are using.

     

    These scripts can only work in Acrobat.

     

    Look at PDFtk and the shuffle operation to collate pages. There are even more options than provided by the scripts/

     

    If at 60+ and no computer training in college and not an IT professional, if I can figure this out, you should be able to resolve it.

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2013 1:57 PM   in reply to GKaiseril

    @GKaiseril What version of Acrobat do you have? I have Acrobat 11 and I think that might be the issue. By the way, I hit my computer with a hammer and that did not help. Thank you for your continued assistance! I kind of gave up hope earlier, but I've got a 50-page document that needs collating so I'm willing to give it another try. (I'm still irritated that this isn't a standard feature, but hey...)

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2013 2:08 PM   in reply to Mark Cramer

    Have systems with version 8, 9, X, and XI.

     

    There are features that are far more needed than a collation tool.

     

    For the project I needed this for, I ran it through the JavaScript console.

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2013 2:19 PM   in reply to GKaiseril

    @Gkaiseril - So with Acrobat XI, what happens when you get to the "Set document actions" button? Here is what I said previously when I got stuck. I have no idea how to go from there.

    Mark Cramer wrote:

    I found the JavaScript button which has a button "Set document actions". When I press it I get a box that says, "When this happens..." with options like "Document will close" and "Document will save." I opened up a couple of them and pasted in the JS and tried to run it, but nothing happened.
     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2013 2:35 PM   in reply to Mark Cramer

    Do not use the "Set Document" actions. These actions are for use when printing, opening, saving, or closing a PDF. They have nothing to do with combining PDFs and I do not see were they are appropriate.

     

    If you get the scripts in the correct folder for your version of Acrobat, you should see the added buttons under the "Edit" menu option.

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2013 3:56 PM   in reply to GKaiseril

    Holy cow! I'm finding this a little hard to believe, but I got it to work. With Adobe XI the folder is C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts. I just copied the script above, saved it as collate.js and voilà. Amazing. Thank you, GKaiseril, for all the help! I'll put my hammer away now.

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2013 2:15 PM   in reply to Mark Cramer

    Hello, it sounds like the javascript solution will suit most people, but it is possible to do it yet another way!

    For instance, you have scanned a book two pages per pdf page.

    Create directories "odd" "even" and "output".

    You crop all the odd pages and extract all pages to the odd directory as separate files.

    Undo the crop, then crop all the even pages and extract all pages to the even directory as separate files.

    The file prefix must be the same for the odd and even pages, which is why I use undo and recrop.

    Select "Add Bates Numbering" under pages, edit page design.

    Select the "odd" directory and output to the "output" directory. Add a zero to the original file name in output options.

    Select the "even" directory and output to the "output" directory. Add a one to the original file name in output options.

    You should have in the output directory pages in pairs like, mybook 10.pdf mybook 11.pdf, mybook 20.pdf mybook 21.pdf.

    If you select "Combine Files" in Acrobat and select the "output" directory, they will appear in order.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)