• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

378

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

Community Expert , 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.

Votes

Translate

Translate
Community Expert ,
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.

Votes

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!

Votes

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
Community Expert ,
Dec 11, 2018 Dec 11, 2018

Copy link to clipboard

Copied

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

Votes

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

/}

Votes

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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

Copy link to clipboard

Copied

LATEST

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

Votes

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