Skip to main content
subvet720
Participant
December 11, 2018
Answered

Using an Action, how do I repeat a text field that I created on the top of the first page?

I created an Action that creates a text field on the top of the page. How do I get it to repeat it on the top of the remainder of the pages in the document?

// Create the "DatePrinted" field on the top of the first page

var fldTop = this.addField("DatePrinted", "text", 0, [36,774,576,756]);

fldTop.value = "DatePrinted";

fldTop.textSize = 14;

fldTop.textfont = font.Arial;

fldTop.textColor = color.red;

fldTop.alignment = "center";

fldTop.display = display.hidden;

fldTop.readonly= true;

fldTop.doNotSpellCheck = true;

fldTop.doNotScroll = true;

Any assistance will be greatly appreciated,

Thanks

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
December 11, 2018

You need to place your code inside a loop from 0 to this.numPages, changing the third parameter of the addField method to the page number in each iteration.

5 replies

subvet720
subvet720Author
Participant
December 12, 2018

My solution for any interested parties... Not elegant, but it works

for (var pg = 0; pg < this.numPages; pg++) {

// Place text field on the top of the page

var f = this.addField("DatePrinted", "text", pg, [36,774,576,756]);

/}

Translate
try67
Community Expert
Community Expert
December 12, 2018

Why do you say it's "not elegant"?

Translate
subvet720
subvet720Author
Participant
December 11, 2018

That's what I originally thought, but was thinking there had to be a magic way to get er' done. It will work, and Thanks!

Translate
try67
Community Expert
Community Expert
December 11, 2018

No "magical" way to do it, no...

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 11, 2018

You need to place your code inside a loop from 0 to this.numPages, changing the third parameter of the addField method to the page number in each iteration.

Translate