Copy link to clipboard
Copied
Hi
I have this script
found[0].contents = finds[0].parentTextFrames[0].parentPage.name;
which It puts the page number in a field.
is it anyway to make this number hyperlink? it means when click on number goes to the page?
Copy link to clipboard
Copied
Try this :
var main = function(paragraph) {
var doc = app.properties.activeDocument, pages, names = [], page,
n = 0, i = 0, tf, text, source, destination, hyperlink;
if ( !doc ) return;
tf = doc.pages[0].textFrames.add();
pages = doc.pages.everyItem().getElements();
n = pages.length;
while ( i<n ) {
tf.parentStory.recompose();
page = pages;
tf.parentStory.insertionPoints[-1].contents = page.name;
tf.parentStory.recompose();
tf.overflows && tf.fit( FitOptions.FRAME_TO_CONTENT );
text = tf.parentStory.lines[-1];
source = doc.hyperlinkTextSources.add( text );
destination = doc.hyperlinkPageDestinations.add( page );
doc.hyperlinks.add ( source, destination, {name:"Go to page "+page.name } );
i<n && tf.parentStory.insertionPoints[-1].contents ="\r";
i++;
}
}
var u;
app.doScript ( "main(app.activeDocument.stories[0].paragraphs[-1])",u,u,UndoModes.ENTIRE_SCRIPT, "The Script" );
But I have this feeling that should be achievable through standards features :S
HTH anyway
Loic
Copy link to clipboard
Copied
Yes this feature already existe
Just select the page Number and choose hyperlink in the panel to add it
It's a screenshot about the French Version
Copy link to clipboard
Copied
I think the best technique to answer your question and turn the numbering boc into a button is choose the action "Go to the next page"
Interactive: Convert to Button
Apply the action you want
See the result in Pub preview
Copy link to clipboard
Copied
Voilà
Copy link to clipboard
Copied
And the 3nd solution :
Go to text menu, choose Hyperlink and Cross-references
Choose the link type, page in this case
You can choose the document
Choose the page Number
Choose a zoom type if you want
And voilà !!
I hope you Will find the answer betweem this 3 options