4 Replies Latest reply on Sep 26, 2012 9:39 PM by Bill joy

    CrossReference using Text Anchor of another file

    Bill joy

      Hi All


      I have an Indesign file "Untitled-2.indd" with TextAnchor "reference".

      I want to create CrossReference using Text Anchor "Adobe" of "Untitled-2.indd" file in another Indesign file on text "Adobe Indesign".


      How get TextAnchor of "Untitled-2.indd" file and use them to create CrossReference.

      I am using this script :


      var myDocument = app.documents.add();

      var myTextFrame = myDocument.pages.item(0).textFrames.add();

      myTextFrame.geometricBounds = ["10p", "15p", "30p", "35p"];

      myTextFrame.contents = "Adobe Indesign";

      var text =myTextFrame.texts.firstItem();

      var hyperlinkURLDestination =myDocument.hyperlinkURLDestinations.add("C/Documents and Settings/Administrator/Desktop/Untitled-2.indd");

      var xRefForm = myDocument.crossReferenceFormats.item("Page Number");

      var source = myDocument.crossReferenceSources.add(text, xRefForm);

      var myLink =myDocument.hyperlinks.add(source, hyperlinkURLDestination);


      It give error "The destination is invalid. You can only create CrossReference to a Text Anchor or Paragraph destination".