5 Replies Latest reply on Jun 13, 2008 6:07 AM by Patrick Leckey

    command line / batch processing

      To be honest, I've only ever used acrobat to read pdfs. That's it. But now I'm trying to put together a packet for work from a bunch of pdfs. Basically, I'll end up with 10+ pdf files with multiple pages each, but I only want my packet to have usually just one page out of each of the original pdfs.

      That doesn't seem so clear... I start with a bunch of multi page pdfs. Find the page I want, rename the file to "pageIWantNumber OriginalTitle.pdf" (ie "4 ee_5401_33428").

      Then, later on, I want to print out only the selected pages, like in my ie only page 4 from that pdf. Now if I have to just print these to printer that's ok but not ideal.

      Ideally I'd like to end up with either multiple pdf files with only one page (so the multiple page pdfs get cut down to only one page, but there are still a bunch of them). And/or then concat them all together to get a multipage single pdf that has each single page from the original multiple page pdfs.

      It's not as complicated as it is to explain I don't think.. Hopefully you guys understand. My goal is to automate this, using the space in the filename as a delimiter or something so I can just get all of these done really quickly.
        • 1. Re: command line / batch processing
          Level 1
          I found this in another post:
          Geo Kaiser - 2:25pm Jan 25, 08 PST (#1 of 3)

          Have you looked at the "Print 1st Page" batch process?

          The script for that command is:

          /* Print 1st Page */
          /* This sequence prints the first page of
          each document selected to the default printer.

          / this.print
          bUI: false,
          nStart: 0,
          bSilent: true

          So you can ceate a new batch process and copy the 1st page script and then add the "nEnd" parameter:

          /* Print Pages 1-5 */
          /* This sequence prints the first six pages of
          each document selected to the default printer.
          / this.print
          bUI: false,
          nStart: 0,
          nEnd: 5,
          bSilent: true

          Which is very similar to what I want to do, but I need to pull off the nStart value from the file name somehow. So "6 4 2 ee-325" would produce something like:
          "nStart:2, nStart:4, nStart:6" or something.

          Doing this through a .bat file of some sort would be ideal, so maybe I could do the file name parsing through the .bat file and then use a command line interface to adobe to get this done?

          acrobat.exe filename.pdf -print 2
          acrobat.exe filename.pdf -print 4
          acrobat.exe filename.pdf -print 6
          • 2. Re: command line / batch processing
            (Aandi_Inston) Level 1
            Command lines are considered an obsolete way of working (at least
            according to Microsoft, and they tend to set the style of doing things
            in Windows).

            There is an extensive OLE/COM interface to Acrobat. This also includes
            a Visual Basic:JavaScript interface which can be used to run

            So this is a programming, not a command line, solution. The Acrobat
            SDK has details.

            Aandi Inston
            • 3. Re: command line / batch processing
              Patrick Leckey Level 3
              Just so you'll stop posting in every thread you can find (asking once really is enough, going over the top kind of annoys the people you're asking for help):

              var fName = this.documentFileName;
              var pageSplits = fName.split(" ");
              var total = pageSplits.length - 1; // We don't want the actual filename

              for ( var i = 0; i < total; i++ )

              bUI: false,
              nStart: parseInt(pageSplits[i] - 1, 10),
              bSilent: true


              This is not robust at all. The only spaces allowed in the filename for this to work have to be between the page numbers; i.e. "2 4 6 ee-235 479j.pdf" as a filename won't work, as the above code will then think "ee-235" is a page number.
              • 4. Re: command line / batch processing
                Level 1
                Sorry, I honestly didn't think the forum was very active, until I had done some of the over-the-top posting, then i started looking at the timestamps (like I should have done initially) and realized there was tons of activity on here. VERY very sorry about the multiple / annoying posts. I know I look like a terd here now lol, so I really appreciate your helping me anyway.

                As far as cmd line being outdated, yea i know it's not common anymore, but its like, the quickest way to get something done for me usually.

                That script you posted PDL looks pretty awesome. Where do I put it though, since I can't put it in a .bat file or whatever?
                • 5. Re: command line / batch processing
                  Patrick Leckey Level 3
                  You would use it as a batch script from inside Acrobat. It will let you select a group of files or a directory full of files, and then recursively run that script against all the files selected.

                  There is lots of documentation about batch scripting included with the SDK.