Copy link to clipboard
Copied
Hi,
I need to place a processing instruction at the beginning of every text frame. The instruction itself will contain the page number.
I already worked out a script that will bring the instruction into the document as text, but since that causes page reflow, I would rather it come in as an xml marker. (Just as an aside, the script I mentioned goes from the end of the file to the front, to prevent reflow from being an issue on page breaks.)
What is the best way to do that? I do see how to create the instruction itself: but how do I insert it in place?
Something like this?
var myXMLProcessingInstruction = myRootXMLElement.xmlInstructions.add("blah", "blah");
Copy link to clipboard
Copied
By Using the below script you can insert tag of start of each and every paragrapgh
var mydoc = app.activeDocument;
var myPg = mydoc.pages;
pages[0].textFrames[0].words[0].insertionPoints[0].associatedXMLElements[0].xmlInstructions.add("pageStart", "TextFrameStart");
Copy link to clipboard
Copied
A different idea would be to add a label with the instructions to a text frame.
textFrame.label = "Processing instructions here."
Using this you would even see the label's contents in the UI when using the Scriptslabel Panel.
The contents of the label could even be a string of ExtendScript code you could execute by using doScript() or eval().
var instructions = textFrame.label;
eval( instructions );
Regards,
Uwe
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more