6 Replies Latest reply on Dec 13, 2012 1:02 AM by Test Screen Name

    Create a JS to Split Documents - Adobe X

    EngSq

      Does anyone have the JS to use the Adobe X Split Documents feature?  We use the same settings each time we split, so I would like to add a Icon to do this step for us if possible, so we just need 1 press of a button.

        • 1. Re: Create a JS to Split Documents - Adobe X
          gkaiseril MVP & Adobe Community Professional

          Probably not. One needs to write the script for the action and place that code on every system that will use the code. Then you need to create a script to add the button to the tool bar and call the script for the for the action.

           

          extractPages

          Privileged versus non-privileged context

          attToolButton

          Icon Stream

           

          You might to purchase:

          AcroButtons

          • 2. Re: Create a JS to Split Documents - Adobe X
            EngSq Level 1

            Doesn't really answer the question.  I have already wrote the code to add the button and I have no issue with adding that to each machine that uses it, I just need to fnd the code that will Split the Document to a pre determined path, using the Bookmark name as the file name.  Extact pages does not work, it only takes the top level document and not pages under it.

            • 3. Re: Create a JS to Split Documents - Adobe X
              gkaiseril MVP & Adobe Community Professional

              You can pragmatically build the path and file name for use in the extractPages method.

               

              You did not specify bookmarks in your question. Many use a range of page numbers. You will have to get the page numbers the bookmarks refer to by using JavaScript to execute the bookmark and then pickup the resulting page number. This assumes the bookmarks goto a specific page within the PDF. Bookmarks can link to web pages, execute JavaScripts and do all sorts of other actions.

               

              There are posts about building paths and file names and locating page numbers by executing bookmarks.

               

              From what looks like a prior question of yours, you may need to walk the bookmark object to figure out the next bookmark at the same level of the one you are starting from.

               

              Too much work for a free answer.

              • 4. Re: Create a JS to Split Documents - Adobe X
                EngSq Level 1

                I'm guessing you haven't tried the Split Document feature in Adobe X.  The logic is there obviously, I'm just trying to use it, not reinvent it.

                 

                The other question was based on Adobe 9, this is for Adobe X.  Different features.

                • 5. Re: Create a JS to Split Documents - Adobe X
                  gkaiseril MVP & Adobe Community Professional

                  Bookmarks have the same features across all versions.

                   

                  The JavaScript for extracting pages has only changed for the privileged operation.

                   

                  If you use execute menu items in JS be real careful because the menu names for use in JS do change.

                  • 6. Re: Create a JS to Split Documents - Adobe X
                    Test Screen Name Most Valuable Participant

                    Thanks, I hadn't seem, the Split Document feature.

                     

                    But you are making a simple and obvious, but wrong, assumption. Just because you can do something with the user interface (that is, by clicking and typing in Acrobat), doesn't mean there is a matching way to do it in JavaScript. (And vice versa). They are two quite different sets of features, and unless Adobe have added a document.splitPages method there isn't a direct way to access it. Equally, there is no method in JavaScript to run tools and click in dialogs. Given that, reinventing it might be possible and/or necessary.