Highlighted

Image not showing when open IDML file using Indesign Script and save as INDD

Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

In our project, the user is uploading IDML file and we have to save it as INDD using Indesign script. I have created the script and open the IDML file using app.open method and then saving it as INDD file using documents.save method. It saves the INDD file but when I open that INDD file in the Indesign UI, it doesn't show the image thought link of that image is showing in links section. I have tried so many ways but still didn't get success. Please help if anyone has faced such issue and fixed it. 

 

See code below.

var IndesignTemplateFolderName="d:";

var myDocuments = app.open(File("d:/test.idml"));

var IndesignTemplateName_INDD_Name=IndesignTemplateName.name.replace(".idml", ".indd");
var IndesignTemplateName_INDD=IndesignTemplateFolderName+"/"+IndesignTemplateName_INDD_Name;

myDocuments.save(new File(IndesignTemplateName_INDD),true);

myDocuments.close();

TOPICS
How to, Scripting

Views

84

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Image not showing when open IDML file using Indesign Script and save as INDD

Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

In our project, the user is uploading IDML file and we have to save it as INDD using Indesign script. I have created the script and open the IDML file using app.open method and then saving it as INDD file using documents.save method. It saves the INDD file but when I open that INDD file in the Indesign UI, it doesn't show the image thought link of that image is showing in links section. I have tried so many ways but still didn't get success. Please help if anyone has faced such issue and fixed it. 

 

See code below.

var IndesignTemplateFolderName="d:";

var myDocuments = app.open(File("d:/test.idml"));

var IndesignTemplateName_INDD_Name=IndesignTemplateName.name.replace(".idml", ".indd");
var IndesignTemplateName_INDD=IndesignTemplateFolderName+"/"+IndesignTemplateName_INDD_Name;

myDocuments.save(new File(IndesignTemplateName_INDD),true);

myDocuments.close();

TOPICS
How to, Scripting

Views

85

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 30, 2020 0
Adobe Community Professional ,
Aug 02, 2020

Copy link to clipboard

Copied

Hi

I edited your post to add the Scripting tag so the scripters are more likely to see it.

~ Jane

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 02, 2020 1
Adobe Community Professional ,
Aug 02, 2020

Copy link to clipboard

Copied

IndesignTemplateName_INDD_Name is undefined in the snippet above, when you do the replace. You can try this instead: 

 

var IndesignTemplateFolderName="d:";

var myDocuments = app.open(File("d:/test.idml"));

var IndesignTemplateName_INDD_Name=myDocuments.name.replace(".idml", ".indd");
var IndesignTemplateName_INDD=IndesignTemplateFolderName+"/"+IndesignTemplateName_INDD_Name;

myDocuments.save(new File(IndesignTemplateName_INDD),true);

myDocuments.close();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 02, 2020 1
Community Beginner ,
Aug 03, 2020

Copy link to clipboard

Copied

Thanks for your quick reply, 

 

Sorry I didn't sent whole script to you, just sent you the main portion which I use to save the document as .Indd, In my script there is already defined the 'IndesignTemplateName' varaible so it doesn't get undefined 'IndesignTemplateName_INDD_Name', It replace correctly and gets name correctly in the 'IndesignTemplateName_INDD_Name' variable and saves also as .Indd but it doesn't shows the images. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 03, 2020 0
Engaged ,
Aug 03, 2020

Copy link to clipboard

Copied

 Hello Kiran_Shah,

 

I doubt it has anything to do with your script, I've seen similar issues before......

What is the behavior if you manually open the .idml file, dose the image show?

It could be in the original .indd file where the .idml file was saved from, the user may have had the image hidden or was on a page other than the one the image was placed on.

It could be as simple as resaving the .idml file

 

Regards,

Mike

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 03, 2020 0
Adobe Community Professional ,
Aug 03, 2020

Copy link to clipboard

Copied

Hi Kiran_Shah,

you could relink every linked image and graphic in your document with itself.

 

See DOM documentation by Gregor Fellenz for method relink() of the link object that itself is a member of the Links collection of the document:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Link.html#d1e299136__d1e299895

 

Access the allGraphics array of the document or go through every link in the Links collection.

Make sure that you only access linked items if you use the allGraphics array or that you do not use linked stories when using the Links collection.

 

Regards,
Uwe Laubender

( ACP )

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 03, 2020 0