: Custom data inside IDML files I’m looking for a way to inject custom data inside IDML files via scripting, but I’m not sure that it’s possible. The IDML specification states “IDML supports
I’m looking for a way to inject custom data inside IDML files via scripting, but I’m not sure that it’s possible.
The IDML specification states “IDML supports the inclusion of new scripting objects and properties added by InDesign plug-ins.”, but there is no mention about scripting.
I already tried adding a custom variable to the TextFrame object but with no luck (apparently the object structure is immutable).
Is there any way to do this without having to write a plugin?
It should be possible to add custom data to XMP (https://indisnip.wordpress.com/2010/09/07/storing-custom-data-into-indesign-file-xmp/) but that would require a lot more work because I would have to reference every object in some way and their custom values. Plus, I have to check XMP specs because I’m not sure if there are limitations in size for custom data (that could be a problem).
More posts by @Megan533
1 Comments
Sorted by latest first Latest Oldest Best
You can make use of scripting labels to save information in your idml file.
// create a new doc
var doc1 = app.documents.add();
// add a label
// everything can have a scripting label
// textFrames, ovals, pages, swatches ...
doc1.label = 'foo';
// save the file
doc1.save(new File('~/Desktop/doc1.indd'));
// export the idml file
doc1.exportFile(ExportFormat.INDESIGN_MARKUP, new File('~/Desktop/doc1.idml'), false);
// close the first document
doc1.close();
// open the idml file
var doc2 = app.open(File('~/Desktop/doc1.idml'));
// read the label
$.writeln(doc2.label); // returns 'foo'
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.