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

New Here ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript, Windows

Views

90

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Dec 11, 2018 Dec 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.

Likes

Translate

Translate
Most Valuable Participant ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

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!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

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]);

/}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines