Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unable to remove some hyperlinks

People's Champ ,
Nov 12, 2018 Nov 12, 2018

Hi,

So there is a document I am working on where a TOC has been set and now I need to remove every single hyperlinks. It does work for 90% of items but some persist.

I can understand I am not processing the good items there but according to documentation* the remaining item seems to be a hyperlink and so should have been removed to.

* Edit text in InDesign

Point is if I ever try to remove it manually, InDesign just crashes. So I am wondering if the document is just corrupted at some point (also export to idml generates a corrupted file).

before :

before.jpg

after :

after.jpg

the code :

removeHyperlinks:function(doc){

this.removeCollectionInstances ( doc.hyperlinks );

this.removeCollectionInstances ( doc.hyperlinkExternalPageDestinations );

this.removeCollectionInstances ( doc.hyperlinkPageDestinations );

this.removeCollectionInstances ( doc.hyperlinkTextDestinations );

this.removeCollectionInstances ( doc.hyperlinkURLDestinations );

this.removeCollectionInstances ( doc.hyperlinkTextSources );

this.removeCollectionInstances ( doc.hyperlinkPageItemSources );

this.removeCollectionInstances ( doc.crossReferenceSources );

},

removeCollectionInstances:function(collection){

var instances = collection.everyItem().getElements(), n = instances.length, nInstance;

while ( n--) {

nInstance = instances;

nInstance.remove();

}

},

any ideas welcome 😕

TOPICS
Scripting
312
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation