Copy link to clipboard
Copied
Hi,
The target is to add a textFrame with centered page number out under every page. I know can do it with master pages but don't want to affect. It's only for printing proofs.
How to center page number into textFrame?
Can anyone help me to complete this script?
Thanks a lot
Mario
Hi Grandeforedit,
one can set this up while adding the text frame.
Provide an object as argument to method add().
The other trick is to define text formatting with property parentStory, also with an object.
Text frame preferences can be done as well.
Example:
var doc = app.documents[0];
doc.textFrames.add
(
{
contents : "Hello World!" ,
geometricBounds : [0,0,"100mm","100mm"],
strokeWidth : 0 ,
strokeColor: "None" ,
parentStory :
{
justification : Justification.CENTER_A
...
Copy link to clipboard
Copied
Assign a variable to each created frame, say 'tf', then within your for loop after you've created the frame:
tf.texts[0].justification = Justification.CENTER_ALIGN;
Copy link to clipboard
Copied
Thanks Brian, not sure I understand how to assign a variable to each created frame but you point me to a solution.
Testing it seems to work on the right frame ...I hope
thanks again
Mario
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Grandeforedit,
one can set this up while adding the text frame.
Provide an object as argument to method add().
The other trick is to define text formatting with property parentStory, also with an object.
Text frame preferences can be done as well.
Example:
var doc = app.documents[0];
doc.textFrames.add
(
{
contents : "Hello World!" ,
geometricBounds : [0,0,"100mm","100mm"],
strokeWidth : 0 ,
strokeColor: "None" ,
parentStory :
{
justification : Justification.CENTER_ALIGN ,
pointSize : 20 ,
fillColor : doc.colors.itemByName("Magenta") ,
fillTint : 50 ,
leftIndent : "20 mm" ,
rightIndent : "20 mm"
} ,
textFramePreferences :
{
verticalJustification : VerticalJustification.CENTER_ALIGN
}
}
);
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
It works great,
what a lesson about nested proprerties and preferences!
Thanks, thanks a lot Uwe.
Mario