Rearranging existing bookmarks with javascript

Hi,
I run Create > PDF from Web Page and I end up with a PDF where I have all bookmarks pointing to the correct pages, but some of them are in the wrong order, and all are in the same level.
I need to programmatically reorder the bookmarks using javascript. I have never used javascript before, so if anybody had done something similar and could give me a hand, it would be greatly appreciated.
Thanks!
Flavia

There is a bookmark object in the Acrobat JavaScript model.  Look it up.  It has a method named insertChild(). You can use this function to reorder the bookmarks.  You could even do it based on page order. However, if this is a one time activity, it's just as easy to reorder them by hand, in Acrobat.
You can also write a script to automatically reorder the pages based on the bookmarks using the the "doc.movePage()" function. I've written lots of scripts to do this sort of thing. In fact, there is one up at www.pdfscriting.com. It's labeled "Use Bookmarks to Re-order pages"
Thom Parker
The source for PDF Scripting Info
pdfscripting.com
The Acrobat JavaScript Reference, Use it Early and Often
Then most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)
Having trouble, Why Doesn't my Script Work?

Similar Messages

  • Javascript question. Possible to save bookmark with javascript in Safari?

    Is it possible to save a bookmark using javascript in Safari?
    In IE I use:
    window.external.AddFavorite(url, title);
    In Firefox I use:
    window.sidebar.addPanel(title, url,'');
    In Safari I have no clue.
    Any thoughts, is it even possible?

    I'm going to call this bookmark function from inside a Flash application and I don't want the URL to be the exact URL that the Flash application has.
    If you have a solution to the problem I would be very happy if you could post it!

  • Access embedded reader with javascript

    For a project I'm looking for a way to display pdf files within a webbrowser. I have IE8+ with acrobat reader available to me, so i can display any given pdf. But i would like to be able to change pages, jump to bookmarks with javascript functions in my html page.
    So in other words: does acrobat reader have somesort of api through which i can access my document using javascript?

    Post the query in the forum for Acrobat SDK.

  • How can i optimize my SEARCH ENGINE???I use godaddy.i contact them and they give me this conclusion:Search engines are not pulling up your other pages on your website because it is created with javascript. the content on the pages, (photo gallery.....

    conclusion from godaddy:
    Search engines are not pulling up your other pages on your website because it is created with javascript.
    the content on the pages, (photo gallery, My Recipes/Blog, History, Friends) need to be formatted to HTML, PHP or CSS. No search engines (google, Yahoo, Bing) can crawl//analyze webpages built with javascript.
    See if Apple allows iweb to create the pages in HTML format and ask how to make those changes.
    I spend more then 1 hour on the phone with them but we didn't find the solution...
    please i need help because like this nobody can rich my website...
    www.chefdiego.com
    thank you

    The part of iWeb pages that give the search engines problem is the navbar.  That's javascript based.  One way to get around that is to create another blank page in the site that's not  included in the navbar. 
    Add a text based navbar in that page with just the other pages in the site. 
    Also you can use that page for creating the sitemap for Google at Create your Google Sitemap Online - XML Sitemaps Generator.
    Have you let Google know your site exists? This website describes how to get it recognized: Get your iWeb website found in search engines like Google Yahoo MSN and Bing.
    OT

  • Split PDF following preserving existing bookmarks

    Hello,
    Is it possible to split a PDF using Acrobat XI by top level bookmarks, while retaining existing bookmarks in the resulting files?
    With the default split it creates the new PDF's, but looses the bookmarks.
    Thanks for any suggestions.
    PS: I am on a Mac platform

    If it happens always at a specific location check if there's something out
    of the ordinary with that bookmark. For example, does it contain any weird
    characters in its name? Is it identical to another bookmark (or even to the
    name of the document itself)?
    I would think the application could handle those situations, but maybe it
    can't...

  • Edit existing Bookmarks to renamed Querie

    Hello experts,
    we have the following scenario:
    We have users in our BI portal which have created bookmarks to BI queries.
    Now we want to rename all queries to a new Name-convention.
    The existing bookmarks won´t work anymore because they are all linked to the old names of the queries.
    Now we went to the backend system and edit the following tables:
    RSWR_DATA and RSWR_DATA_XREF to the new-named queries. But this doesn´t work. XML parser get´s an error.
    Anyone who has an idea to solve this problem? Queries would be renamed and favorites/bookmarks should point to the new (exactly the same, except the technical-name) queries!
    Thanks and Greetings
    Marc

    If you ever get an answer, please let us know because we are struggling with the same problem.
    Kind regards from Belgium,
    Ben

  • Organize Bookmarks: I want to rename a batch of ~100 bookmarks with search-replace

    Organize Bookmarks:
    I want to rename a batch of ~100 bookmarks
    changing words in the "name" field with search-replace
    Please
    (a) tell me a work-around, or
    (b) program a plugin for a more advanced bookmarks editor.
    thanks a lot!

    You will have to export the bookmarks to an HTML file and edit that file to make the change. You need to remove all existing bookmarks before re-importing that changed file or you will have to remove all duplicates. If all the bookmarks that need to be changed are in one folder then you can remove the other bookmarks while editing.
    See http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • I followed directions of arrowing down and hitting delete, but cannot get certain addresses out of by address/location bar. What am I doing wrong? I also have not been able to figure out how to move existing bookmarks into folders.

    I am running Windows Vista, Firefox 3.6.13, on a 18 month old HP a6700f. I read the embedded help, but the instructions for deleting addresses doesn't work and it doesn't tell how to move existing bookmarks to a folder.

    See:
    * http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox
    Entries in the location bar drop down list with a yellow (blue on Mac) star at the right end are bookmarks.<br />
    You can remove such a bookmarked item that shows in the list if you open that url in a tab and click the yellow star in the location bar.<br />
    This will open the Edit This Bookmark dialog and you can click the Remove button to remove the bookmark if you want to remove such a bookmarked entry.<br />
    * [[Clearing Location bar history]]
    * [[Cannot clear Location bar history]]

  • Button with Javascript appearance changed.

    Hi,
    I created button with javascript from
    Re: Button and Function
    Everything works fine, But button looks different now
    No appearance of button is there & button label is displayed in orange color.
    Have i missed something or i will never like original.

    I have done some changes suggested by ATD for another thread.
    In your app, through Shared Components, Templates create a new button template based on a copy of an existing one (pick whichever existing template you prefer, the normal Button may be ok). When the new template is created, edit it. You should see something like the following in the "Template" setting:
    a href="#LINK#" class="t12Button" #BUTTON_ATTRIBUTES#>#LABEL#</a
    There may be other HTML around this, but this is the important part as it is the actual button itself. Change this to:
    a href="#" class="t12Button" #BUTTON_ATTRIBUTES#>#LABEL#</a
    Now, on your button on the page, change it to use your new button template. In the Button Attributes setting, add in:
    onclick="javascript:checkText();"
    everything works fine except appearance of button.
    Edited by: TEJU on Jun 4, 2009 10:21 AM
    Edited by: TEJU on Jun 4, 2009 10:22 AM
    Edited by: TEJU on Jun 4, 2009 10:24 AM

  • Please help with Javascript obejcts hierarchy

    Hi!
    Is following Javascript obejcts hierarchy is right?
    1. App > 2. Doc > 3. Page >
    (from Page) > 3.1 Annotation3D
    (from Page) > 3.2 Field (link)
    thank u )

    You have to have Acrobat/Reader open to open a PDF and use some or all of the Acrobat JS features.
    When Acrobat/Reader is started various folders are accessed and files within those folders read and processed to create the application. This includes dictionaries, certain global variables, various functions provided by Adobe, and user defined functions or variables. The Adobe provided functions or user provided functions or variables are accessed by their assigned name. So if you created an application folder level function in a file called 'hello.js' containing the following code:
    function HelloWorld()
    app.alert('Hello World!');
    return;
    HelloWorld();
    Each time you open Acrobat an alert box with "Hello World!" will appear.  So even without any PDF open one can perform or have a task done. With application level scripts, you can add menu item, tool bar buttons, or modify menu items, etc. So when you open Acrobat you could have a menu item to create a new blank PDF or add the JS API Reference to the "Help" menu item. And if you selected "Help => JavaScript API', the JS API Reference file would open, whether there is an open PDF or not.
    PDF files are opened at the application level, as the application needs to interpret the code of the PDF file and provide the necessary resources for displaying, calculating, linking, etc for the open PDFs. If you open a PDF pragmatically, you need to provide an object name to that PDF. Especially if you are going to reference that file with JavaScript.
    Within an open PDF there are various actions. The first is the document level scripts that are used to establish the environment in which that PDF will function. This could include special functions to sum values, compute date differences, perform special key stroke and formatting. There can even be test to see if there are any necessary application level functions available for use the the document.
    Within PDF document you can can fields, links, comments, etc. And these items only exist in the PDF document and rely on the PDF document for performing the various task or communicating those task the the application.
    By the way with the "HelloWorld" function defined in the application JavaScirpt folder, and PDF opened on that computer can have a button with the 'mouse up' action JavaScript of "HelloWorld();" for the code and any time that button is pressed the alert box that appeared when Acrobat was started will appear. But if you take that PDF to another computer that does not have that file nothing will happen or an error box will appear.
    See Getting Started - Developing for PDF by Dave Wright and look around the Planet PDF site.
    You also need to realize that Acrobat JavaScript does not run synchronously, so you do not always have the individual scripts running in the same order or speed so it is possible a script will not always start and end before the next script in line is started or ends. And if you have dependencies between these scripts you need to test to see if they are all met.

  • After upgrade to 6.3.4 cannot create new bookmarks by dragging nor open existing bookmark properties

    Just upgraded to 3.64. Now I cannot create new bookmarks either by dragging a URL or trying to create a new one in organize bookmarks. For existing bookmarks when I hit properties on the pop up menu all I get is a title bar that says "bookmark properties for (name of bookmark)" but I can't resize it or otherwise manipulate the title bar to access information or change the properties

    Hello Victor.
    You may be having a problem with some Firefox add-on that is hindering your Firefox's normal behavior. Have you tried disabling all add-ons (just to check), to see if Firefox goes back to normal?
    Whenever you have a problem with Firefox, whatever it is, you should make sure it's not coming from one of your installed add-ons, be it an extension, a theme or a plugin. To do that easily and cleanly, run Firefox in [http://support.mozilla.com/en-US/kb/Safe+Mode safe mode] and select ''Disable all add-ons''. If the problem disappears, you know it's from an add-on. Disable them all in normal mode, and enable them one at a time until you find the source of the problem. See [http://support.mozilla.com/en-US/kb/Troubleshooting+extensions+and+themes this article] for information about troubleshooting extensions and theme. You can troubleshoot plugins the same way.
    If you want support for one of your add-ons, you'll need to contact its author.

  • Creating Bookmarks with Relative Links

    Can anyone suggest a plugin, or post examples of code to create a bookmark in Acrobat programmatically.  And have the bookmark work with RELATIVE links.  Meaning if you have a bookmark for page 15, and you insert 5 pages at the begining of the document, that bookmark would move to page 20.  When you create the bookmark with a javascript "go to page", script...  when you insert the pages, your bookmark would still point to page 15, the wrong page.
    Any suggestions, hints, web sites to look at, all appreciated.  Thanks.

    "Is that what you meant?"
    Yes. You can download the VBA example or I can state it as VBScript.
    "Sendkey" may be a problem but you can add some error-traping.
    The same you can archieve with "Menuitemexecute", but you have only one problem more.
    You have to check the registry (if it is free for use) and finaly you have to send the key {enter} to close the action.
    As I said I work with mbtPdfasm for setting bookmarks in a batch. It's much more simple and I can give it to co-worker.
    The other acobat based method without using JS or writing a plugin is to use pdfmark.
    You have to produce a ps-file with the commands to set up the bookmarks, then you have to send it to the Distiller.
    After writing that PDF with bookmarks and necessary blank pages you can replace that with the real pages.
    That sounds not only cumbersome. It is - but it works.
    So for me mbtPdfAsm is the solution for reading/writing simple bookmarks.
    best regards, Reinhard

  • Why does iCloud replace my bookmarks with our warning?

    Why, without warning or notice, would Apple decide it's time to replace my current bookmarks with months/years old bookmarks?
    How, how, how can I replace the bookmark file that exists on iCloud? Because this is getting absolutely ridiculous.
    I honestly have no other way to tell Apple that I cannot stand this. And no other way to figure something out that I would imagine to be simple.
    Please, please, please, please help me out! This is getting so unbelievably frustrating!!!!

    You might try deleting the account, then adding it back with your new password.  Before doing so, if you have any photo stream photos on your device that you wish to keep, save them to the camera roll (unless already there) by opening your my photo stream album, tap Edit, tap the photos, tap Share, tap Save to Camera Roll.  Then go to Settings>iCloud, tap Delete Account, choose Delete from My iDevice when prompted (it will still be in iCloud), then sign back in with your new password and see it it's accepted this time.
    If this works on your iOS device, go to System Preferences on your Mac, click Sign Out, choose Delete at all the prompts, then sign back in with your new password.  Your iCloud data will reappear after a brief delay as it redownloads.

  • Illustrator Script: How can I duplicate a layer ( with sublayers ) with javascript code ?

    Dear All
    I want to duplicate a layer structure, as the "Duplicate Layer" submenu do with Javascript code, but I can't.
    I can duplicate only PageItems or selected object, but no Layers.
    Anybody knows how can I do it ?

    Thanks for your answer.
    #target illustrator 
    var docRef = app.activeDocument; 
    var ln = 'Layer 1'; 
    var ol = docRef.layers.getByName(ln); 
    var nl = docRef.layers.add(); 
    nl.name = ln+' Copy'; 
    for (var a = ol.pageItems.length-1; a >= 0; a--) { 
        ol.pageItems[a].duplicate(nl, ElementPlacement.PLACEATBEGINNING); 
    The problem with this code is, that it can't duplicate also the sublayers, and the sublayer elements.
    Sure I can write a recursive function, but I think there should exist a duplicate function somewhere ( for Photoshop script exist ! ) or a small trick, but I can't find it.
    Thanks

  • Firefox sync is rearranging my bookmarks. Those within folders are being moved to mostly one folder, leaving my other folders empty.

    With the latest version of Firefox, 29, the sync rearranges my bookmarks. It never did under the old version - old version clunky and a pain, new version doesn't work!
    I have tried Aurora, same. I have completely deleted my profile only importing my bookmarks from a backup. As soon as I enable sync, after a while the bookmarks are rearranged.
    I keep all my bookmarks on the bookmarks toolbar folder, half a dozen folders containing a few dozen bookmarks. To the right of these I have maybe fifteen of my most used regular sites.
    When I enable sync, the folders jump to the right of the links, and all but one of the folders becomes empty of their bookmarks, they all get dumped into one folder?
    This is an essential part of sync for me, followed by the extensions, I love FF and don't want to go back to Chrome, where I defected to for a short while. Chrome totally nails the backup process, privacy aside.

    Hi beardybuck
    Thank you for your question. I understand that the new versions of Firefox appear to be rearranging the order of some bookmarks. If you can reproduce this from an earlier version of the places.sqlite file let's open up a bug with the steps. However there are some tricks to auto sort them [https://addons.mozilla.org/en-US/firefox/addon/auto-sort-bookmarks/ add on for Auto Sorting Bookmarks] as well as a number of other add ons.
    This may be useful as well:
    [[Use bookmark folders to organize your bookmarks]]

Maybe you are looking for

  • HT1751 I have done the above steps but I would like to know if everytime I sync will it create a backup on my external harddrive

    I have windows 7 64 bit and followed the steps in the article.  What I would like to know is if I was to sync my ipad would the backup file be created on the external harddrive automatically or do I have do these steps at least once a week. Everytime

  • Cannot edit phone number from dialer

    How can you edit a phone number in the dialer if it originally came from a text message?

  • Read the data of items

    hi friends, we have the order creation screen in webui. i have seen and found that the item details where we enter product and quantity belongs to a component and the header overviewset, where you see SAVE button, cancel button new, copy etc button b

  • Dual Boot Problem

    I'm trying to dual boot widows xp and  arch. I have everything setup except i cant get grub to start when i turn on the system. All it does is boot into xp. I've read the wiki and everything and it didn't help. Thanks

  • Flashlite3 - Flash content error: 14

    hello, in my latest flashlite3 project sometimes i get the following error: "Flash content error: 14". i can't find any kind of documentation about this error. can anybody help? every 2sec or 5sec i make a load xml request and i have an open netconne