Copy link to clipboard
Copied
Copy link to clipboard
Copied
var destination = doc.hyperlinkTextDestinations.add(dest, {name:termName});So, it is very similar to making any other kind of hyperlink. First, make your destination (dest in that first statement is a text reference into my document) then make a cross reference source, then make a hyperlink joining the two together.
var xRefForm = doc.crossReferenceFormats.item("Page Number Only");
var sourceText = getSource(para);
if (sourceText == null) {return } // I don't think this can happen, but just in case
var source = doc.crossReferenceSources.add(sourceText, xRefForm);
var myLink = doc.hyperlinks.add(source, destination);
myLink.visible = false;
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
// destDoc = destination document.
// xrefDoc = adding cross-reference to this doc.
// Get a pre-existing destination from the destination document.
var dest = destDoc.paragraphDestinations.item('2916');
// Get the cross-reference format.
var xrefFmt = xrefDoc.crossReferenceFormats.item('Full Paragraph & Page Number');
// Add the cross-reference source.
var source = xrefDoc.crossReferenceSources.add(app.selection[0],xrefFmt);
// Add the cross-reference.
var xref = xrefDoc.hyperlinks.add(source,dest);
Find more inspiration, events, and resources on the new Adobe Community
Explore Now