Standard Finishing
4Over

Announcement

Collapse
No announcement yet.

Add a page to the end of a bunch of PDF files

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add a page to the end of a bunch of PDF files

    I have 469 PDF text files that I need to add 1 ID page to the end of each file. I have 469 individual ID pages. Is there a way with Acrobat Pro DC to batch this? Or some other means to do it?
    Any input appreciated,
    Thanks

  • #2
    Tools > Pages > More Insert Options > Insert blank Page (Ctrl+Shit+Q on PC).
    You should be able to create an action from that and then have it do it to every file in a folder.

    Comment


    • #3
      I'm not adding the same ID page to each file, I have 469 different ID pages. Each ID page goes to a specific file. I'll look at that option closer tomorrow, thanks.

      Comment


      • #4
        How are the files named? What is the distribution of page counts (e.g., all 4 pages, 100 x 2 pages and 369 x 3 pages, or more diverse than that)? Do you have access to OS X and/or Linux?

        Comment


        • #5
          Yes, very diverse, have 469 books, varying page counts, need to add a 1 page ID at end of each one, so we have 469 single page ID files. Yes OS X.

          Comment


          • #6
            How are the files named?

            Comment


            • #7
              The book files are named with date codes like 65-1024.pdf and the ID pages are "ITL Id Title blocks_1.pdf", numbered 1-469.

              Comment


              • #8
                Does "ITL Id Title blocks_1.pdf" need to be appended to a PDF whose name begins with "1-" or is there some other way one would know exactly how the files are to be paired up by only looking at the file names? Is another source required for this information - like a spreadsheet?

                Comment


                • #9
                  Yes, appended, no way to tell by filename, but they are in list order, first book in list goes with 1, 2nd with 2, etc.

                  I created the Id pdfs by exporting them from an InDesign data merge file. If I could have named those with the date name also I suppose that would have helped but don't know if that's possible.

                  Comment


                  • #10
                    Originally posted by Prepper View Post
                    Yes, appended, no way to tell by filename, but they are in list order, first book in list goes with 1, 2nd with 2, etc.

                    I created the Id pdfs by exporting them from an InDesign data merge file. If I could have named those with the date name also I suppose that would have helped but don't know if that's possible.
                    https://colecandoo.com/2013/07/13/br...-pdfs-that-is/

                    https://colecandoo.com/2015/09/04/da...now-a-reality/

                    http://prepression.blogspot.com.au/2...ile-Names.html


                    Stephen Marsh
                    Last edited by Stephen Marsh; 02-14-2018, 09:34 PM.
                    Comments are personal and my views may not be shared by my employer or partners.

                    Comment


                    • #11
                      Thanks Stephen for the help, I used the "now a reality" one.

                      Ok, so now I have all the single page ID PDFs named with the same datecode as the original book PDFs I want to append them to the end of. Book PDFs named "DUT65-1212 Investments BCM.pdf" and the ID PDFs as "DUT65-1212.pdf" Guess all I need now, still, is a way to automatically append the IDs onto the Books automatically.

                      Comment


                      • #12
                        Here's a solution with Acrobat javascript using the attached files. It is not thoroughly tested, so check the results very carefully.

                        I'm guessing it's not possible for the script to know in advance what all the filenames are by any simple convention (e.g., named something static followed by a number in the range 1-469), since your example has "1212" in the name. One of the biggest challenges with Acrobat javascript automation is working within its security restrictions. Acrobat cannot enumerate all of the file names, so it has to know in advance somehow.

                        For that reason, this is a two step process that starts with a bash script. Place the listfilenames.command file in a directory containing all 938 PDFs (and no other files), then double-click it to execute. It will list the contents of the directory and save it to a file named "filenames.txt." Now we have a file that the Acrobat javascript knows the name of and can read, and it contains the names of all of the files.

                        Now open Acrobat's javascript debugger (press command-J). You may need to enable javascript, javascript debugger, and interactive console in Acrobat's preferences first. In the console area at the bottom remove any existing text and replace it with the javascript code copied from "Acrobat javascript.txt." Then select the entire script in the console area and press shift+enter to execute (I think it has to be shift+enter, the key in the numpad, not the return key).

                        It will ask you to open a PDF file. Pick any PDF in your working directory. It doesn't matter which one - Acrobat won't do anything special with that particular file - this is only so the script can discover the directory containing all of the PDFs.

                        Now the javascript will open the filenames.txt file from that directory and thereby discover the names of all the files in the directory.

                        It then considers only PDF files whose name contain a space (you should have 469 of them). For each file whose name contains a space ("DUT65-1212 Investments BCM.pdf"), it will look for a PDF file with a name identical to the part before the first space ("DUT65-1212.pdf"). If there is such a file, it will save a new pdf that is a concatenation of the two, named like the first file with "A-" added to the beginning ("A-DUT65-1212 Investments BCM.pdf").
                        Attached Files

                        Comment


                        • #13
                          Kyle, can't say thanks enough, man, you saved the day, or the week I should say! It worked just great, only issue was it wouldn't process more than 50 at a time, after first 2 tries and it stopping on 50, I just did them in groups of 40 and got the job done.

                          Comment


                          • #14
                            Kyle, also wanted to ask, it's safe to assume that the content of the 2 files is safe right and any potential mixups that might happen would just be the wrong files getting merged? I can check the first and last pages pretty quick to verify but not everything in between.
                            Thanks again.

                            Comment


                            • #15
                              You're welcome! Yes, the errors to watch out for are incorrect pairing. If I made a bad assumption about your filenames, you may get an incorrect result (though it should match the behavior I described, barring any bugs).

                              Fortunately, the code does not have to copy individual page elements. It tells Acrobat to merge the documents, so content within a given page should not change and it should be as safe in that regard as when you select "insert pages" from the Acrobat tools. I do a lot of PDF rearrangement and errors like that have been very rare in my experience. Usually one of the PDF files has some bugs in it before the merge, or something weird happens with a font that was subset in both PDFs (haven't seen that one in a long time thankfully).

                              The 50 document limit is very strange. Acrobat javascript can sometimes be like a freight train running downhill without brakes. The code may be trying to forge ahead before the last action is actually finished. I would have expected an error like that to happen when it tried the second document, though, not the 51st. I'll take a look next week and see if I can replicate the behavior.

                              Comment

                              UltimateDuploSmartsoft (Presswise)Standard FinishingKBA4Over
                              UltimateDuploStandard FinishingKBAKBA GTIChili publish4Over

                              What's Going On

                              Collapse

                              There are currently 5135 users online. 129 members and 5006 guests.

                              Most users ever online was 6,151 at 11:36 AM on 11-17-2017.

                              Working...
                              X