These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Copy Bookmarks

Balaji MG
Registered: Jul 6 2010
Posts: 22

Hi,
 
Is there any way to copy the bookmarks from one pdf to another pdf using javascript.
 
Thanks,
Balaji

My Product Information:
Acrobat Pro 8.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
There are two ways to do this: You can either copy the bookmarks themselves with a recursive function, or you can replace the pages of the source document with those of the target document.
The latter has the benefit that it maintains the actions associated with the bookmarks.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
No it's not - the JavaScript API in Acrobat can't access the destination/action properties of bookmarks, so can't copy or extract them.

There are commercial plugins which can do it - such as ARTS PDF Aerialist - but they're expensive.
Balaji MG
Registered: Jul 6 2010
Posts: 22
Thanks Guys...
I have a thought like, we can export the bookmarks as a text file with destination details and the same text file we can import in the targeted pdf. Is this possible? Yes means, how can i do?... I am a beginner in Acrobat javascript.

Thanks,
Balaji
UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
As we've said, using JavaScript you cannot read the actions of a bookmark, only the name displayed in the side panel. Exporting them with the actions and destinations intact is only possible with a plugin.
try67
Expert
Registered: Oct 30 2008
Posts: 2398
That's not completely true. If the bookmarks only point to a page number, then that can be identified with a script and used when re-creating the bookmarks in the new file.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Balaji MG
Registered: Jul 6 2010
Posts: 22
Thanks Expert's...

As Try said, The bookmarks pointing only to the page numbers. So how can i export this info and the same to be imported in the target pdf file?...

Please advise.

Thanks,
Balaji
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You can use the Bookmark object's execute() method to execute it. Then you can read the current page number and use if when re-creating the bookmark in the new file by setting its action with setAction().

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Balaji MG
Registered: Jul 6 2010
Posts: 22
Thanks for your reply. But I am not sure how to use this in Java script bcoz im a beginner in JavaScript. Can you give me a starting code for this, it will help alot for me.

Thanks in advance...

Balaji
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Try67's method only works when the bookmarks being executed are goto page action or a JavaScript that sets a page value. But bookmarks can be used to execute many menu items and run a JavaScript includes more than going to given page number.

George Kaiser