Thread View: adobe.scripting.indesign
1 messages
1 total messages
Started by Stefan_Huwiler
Tue, 10 Mar 2009 08:33
[JS, CS3] Setting Page Destination on Button
Author: Stefan_Huwiler
Date: Tue, 10 Mar 2009 08:33
Date: Tue, 10 Mar 2009 08:33
34 lines
2484 bytes
2484 bytes
Hi
I unsuccessfull try to set the a Page Destination on a Button.
The script loops through the Document and picks certain textframes, which contain the page.name as text. inside the loop I do this:
// START LOOP
// Getting the Content of Textframe -> this is the destination Page Number
myDestinationPage = myDocument.pages.itemByName ( myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].contents );
// Creating a HyperlinkPageDestinationObject
myHyperlinkPageDestination = myDocument.hyperlinkPageDestinations.add( myDestinationPage );
// Creating a new Button over a certain area on the actual Page - setting visibility off
myButton = myDocument.pages[ pageIterator ].buttons.add({visibilityInPdf:1181247844, geometricBounds:[ myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].geometricBounds[ 0 ],12,myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].geometricBounds[ 2 ], myDocument.pages[ pageIterator ].textFrames[ textFrameIterator ].geometricBounds[ 3 ]]});
// Creating an hyperlinkPageItemSource = the Actual Button myHyperlinkPageItemSource = myDocument.hyperlinkPageItemSources.add( myButton );
// Creating an Hyperlink
myHyperlink = myDocument.hyperlinks.add( myHyperlinkPageItemSource, myHyperlinkPageDestination );
//The Destination shall be a Ceratin Page so I add a gotoAnchorBehavior
myGotoAnchorBehavior = myButton.gotoAnchorBehaviors.add();
// Now I try to set the Anchor Target. I think that's not working...
myGotoAnchorBehavior.anchorItem =myHyperlink;
// END LOOP
The Buttons are there, the Destinations as well, but the ceratin button has not the desired Page as destination. Does someone have a hint on this topic?
Thanks and greets
Stefan
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads