Copy link to clipboard
Copied
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.
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 :
after :
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 😕
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now