Skip navigation
Currently Being Moderated

Split PDF Files by Bookmarks

Apr 30, 2008 4:35 AM

Can anyone please let me know how do I split PDF Files by bookmark using Java Script.

I am making a Visual Basic utility to read the bookmarks in PDF Files and split them based on the bookmarks. I am able to split the PDF Files by using Arts PDF Split Pro. However since I am already using Adobe Standard, I would like to do it with Adobe itself.

Thus, I pay license for only one software and not two.

Thanks
Rahul
 
Replies
  • Currently Being Moderated
    Apr 30, 2008 8:08 AM   in reply to (Rahul_Agrawal_IN)
    Coding JavaScripts in Standard can be done, but it is not easy.

    This can be done if and only if the bookmarks you are using for the split go to a page, by using the bookmark "execute" method.

    You are aware bookmarks can do far more then go to a page?

    In Acrobat JavaScirpt one can not see the actions associated with a bookmark or field even though one can set the script action through JavaScript.
     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2008 4:30 AM   in reply to (Rahul_Agrawal_IN)
    I think writing the code will be an interesting project for you. We
    can help you write JavaScript, but I regret that you may find little
    interest in doign the code for you.

    Aandi Inston
     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2008 12:08 PM   in reply to (Rahul_Agrawal_IN)
    Well why don't you show us what you've got and explain what parts you don't understand so that we can help you better understand the method?

    What Aandi meant is that there are very few people who will simply post code for you to take and use. Not a lot of people enjoy giving away work without getting paid for their efforts. We'll help you with the JavaScript you have, but not write the JavaScript for you.
     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2008 2:49 AM   in reply to (Rahul_Agrawal_IN)
    There is no method to find out the page for a bookmark directly. (A
    bookmark might not even go to a page).

    But if your bookmarks are all "normal" (for example, you don't have a
    bookmark to open a new file), you can use the Execute method. After
    using Execute the current page of the document will tell you,
    indirectly, where the bookmark went. You can then record all of this
    information and use it later.

    Aandi Inston
     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2008 3:03 AM   in reply to (Rahul_Agrawal_IN)
    >What I understand from your reply is, by using the Execute method, I can go to the page in the Bookmark. But how do I split the PDF.

    Some combination of creating a new document, PDDoc.InsertPages, and
    saving files.
    >
    >Does Adobe provides a standard method wherein I can split all the pages in a PDF file using a bookmark.

    No.

    >I am able to do this using ArtsPro PDF Splitter or PDSplit.

    That's why they sell it...!

    Aandi Inston
     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2008 6:25 AM   in reply to (Rahul_Agrawal_IN)
    Within a PDF document and knowing the bookmark names to use for the extraction, one can use "bookmark" object's "execute" method to get the page associated with that book mark and then use the "doc" object's "extractPages" method to extract the pages into another PDF. See the Acrobat JavaScript Reference for more information and security restrictions on using path names in methods.
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2010 9:05 AM   in reply to SunRay Cave

    And that is a standalone program and not a user programmable JavaScript within Acrobat. Acrobat JavaScript can not access the code of a bookmark so there is no direct way for Acrobat JavaScript to see the action of the book mark, but other programing languages can see the action of the book marks. So the only sure way to split a PDF by the page action of a bookmark is with a 3rd party plug-in or 3rd party program. Arts PDF Split & Merge can also provide additional features.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2010 9:24 AM   in reply to GKaiseril

    That's not completely accurate. I have created a JavaScript tool for Acrobat

    that can split a PDF by top-level bookmarks (or chapters, as I call it). See

    here:

    http://try67.blogspot.com/2008/12/acrobat-extract-chapters-by-bookmark s.html

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2010 10:04 AM   in reply to Gilad D (try67)

    And the PDF you chose has only bookmarks that go to a specific page in the PDF.

     

    What about bookmarks that open web pages, run a JavaScirpt like an 'app.alert'?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 25, 2010 10:40 AM   in reply to GKaiseril

    My script ignores bookmarks that don't lead to a certain page. Obviously if

    the the bookmark's scripts causes a modal dialog like app.alert, the script

    will be stuck until that dialog is closed. It's up to the user to know which

    kinds of bookmarks their file has.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)