I am trying to ascertain the kerning of the characters in a TextFrame using IDS's SOAP API. For the sake of simplicity I am currently still trying to examine only the first character, which is not any kind of special character (it's an uppercase T). I am using this script to examine it:
var get_all_textframes = function(document, callback) {
var looper = function(collection) {
for(var i = 0; i < collection.textFrames.count(); i++) {
var textframe = collection.textFrames.item(i);
callback(textframe);
}
};
var recurse = function(group) {
for(var i = 0; i < group.groups.length; ++i) {
looper(group.groups[i]);
recurse(group.groups[i]);
}
};
looper(document);
recurse(document);
};
var document = app.open(File("c:\\path\\to\\idsdoc.indd"));
var output = "\n";
get_all_textframes(document, function(textframe) {
if(textframe.id == 357) {
output += ("Kerning: " + textframe.parentStory.characters[0].kerningValue+ " \n");
}
});
document.close();
result.output = output;
However, when I run the script I get an error 30615: The property is not applicable in the current state
.
It works fine if I try to get any other property from the character, rather than kerningValue
. For example, kerningMethod
returns Metrics
.
What circumstance is causing this property to be unavailable, and how can I read it?
The kerningValue will only be accessible if the kerningMethod is set to "None". This property is a string and may vary of your local language. You can manually set kerning to "O" => None and ask the kerningMethod to ensure the proper name.