Copy link to clipboard
Copied
Hi,
I have a simple function in InDesign ESTK script to link images with external web urls like this -
function relink_converted_image(filename, path, converted_label) {
try {
var results = app.documents.item(0).allGraphics;
var found_links = [];
var label = converted_label.split('__doc=').pop();
for(var i=0; i < results.length; i++) {
if(results.itemLink != null) {
var result_label = results.itemLink.label;
if(result_label && result_label == label) {
logMe('found id - ' + label);
var file_web = File(path);
var newLink = results.itemLink.relink(file_web);
found_links.push(results.itemLink.filePath);
try {
results.itemLink['label'] = converted_label;
} catch(e) {
logMe(e.toString());
}
try {
newLink['label'] = converted_label;
} catch(e) {
logMe(e.toString());
}
}
}
}
return JSON.stringify({err: 0, data: found_links});
} catch(e) {
return JSON.stringify({err: -1, data: e});
}
}
the sample input that I am passing is -
relink_converted_image("cfc7cfdf-bc59-4dfc-90af-bfa4d74618da__doc=07012017_comp__id=0xUKYw8.PNG","http://localhost:3000/prod_equation_images/cfc7cfdf-bc59-4dfc-90af-bfa4d74618da__doc=07012017_comp__...", "cfc7cfdf-bc59-4dfc-90af-bfa4d74618da__doc=07012017_comp__id=0xUKYw8.PNG");
and all my images are linked and labelled uniquely locally.
Now, I am not able to relink the found linked graphic with a asset on a different local server with -
File('web_asset_url')
or
results.itemLink.relink('web_asset_url')
Are there any other ways to add dynamic link assets hosted externally with InDesign ?
Copy link to clipboard
Copied