Copy link to clipboard
Copied
i dont know parametr duplicate(destPage,["mx","my"]);
how work mx , my ?
when mx = 0 , my=0 text frame place center page.
pleas description mx , my .
Copy link to clipboard
Copied
According to the documentation this optional parameter -- called by -- is the amount by which to offset the new text frame from the original text frame's position.
Let's illustrate this with example:
I have two pages with a text frame selected on the 1st page.
The following code will duplicate it to the 2nd page shifting it 10 mm to the right and 20 mm downwards:
main();
function main() {
var doc = app.activeDocument;
var destPage = doc.pages[1];
var tf = app.selection[0];
tf.duplicate(destPage, ["10 mm", "20 mm"]);
}
Negative values will shift it to the left and upwards respectively
tf.duplicate(destPage, ["-10 mm", "-20 mm"]);
You can also use other units, say, inches
tf.duplicate(destPage, ["1 in", "2 in"]);
or the default units set for rulers in preferences. (I personally work in millimeters)
tf.duplicate(destPage, [10, 20]);
Hope it helps.
— Kas
Copy link to clipboard
Copied
tanks
Copy link to clipboard
Copied
this have a perablem .
outFrame =sourceFrame.duplicate(destPage,["10 mm","10 mm"]);
the out put is :
this not position 10mm*10mm.
pleas Guide me.
Copy link to clipboard
Copied
this code correct:
sourceFile = File.openDialog ("Show me the source"),
destPage = app.activeDocument.pages[0],
sourceDoc = app.open(sourceFile, false),
sourceFrame = sourceDoc.pages[0].textFrames[0];
outFrame =sourceFrame.duplicate(destPage ,["10 mm","10 mm"]);
outFrame.move(["13 mm","13 mm"]);
sourceFile = File.openDialog ("Show me the source"), destPage = app.activeDocument.pages[0], sourceDoc = app.open(sourceFile, false), sourceFrame = sourceDoc.pages[0].textFrames[0]; outFrame =sourceFrame.duplicate(destPage ,["10 mm","10 mm"]);
outFrame.move(["13 mm","13 mm"]);