I managed to create a TextFrame with text content inside.
var textFrame = page.textFrames.add(); textFrame.geometricBounds = [10, 10, 100, 60]; textFrame.contents = "23"; textFrame.fillColor = bgColor21; var text = lineNameTextFrame.texts.item(0); text.appliedFont = app.fonts.item("Ubuntu"); text.fontStyle = "Bold"; text.pointSize = 60; text.fillColor = white; text.justification = Justification.centerAlign; text.alignToBaseline = false;
The text is centered horizontally using Jusitification.centerAlign, but I can't find in the documentation or debug the property to center vertically.
However, in the InDesign UI, there is a feature:
Does anyone know what text property do I need to set?
Thanks
Try this,
var textFrame = page.textFrames.add(); textFrame.geometricBounds = [10, 10, 100, 60]; textFrame.contents = "23"; textFrame.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
Check this link as well:
Yes! Thanks a lot, it works. The property I was looking for was hidden in textFramePreferences, ok.