Adding control number

New Here ,
Jul 05, 2017

Copy link to clipboard

Copied

Hi,

We have a customer that supplies large pdfs, sometimes up to 8000 pages, that they have created possibly with Word merge or a similar program. Every 4 pages is a new cover letter (or record).

I need to add a padded 4' Arial identifier (record number) that will show in the window of the envelope after the Letters are folded down.

Basically...

PDF p1 would have 0001

PDF p5 would have 0002

PDF p9 would have 0003

PDF p13 would have 0004

...and so forth

Currently I bring it into our variable program, Fusion Pro, and add it there, but it's very long composition.

I'm pretty sure this can be achieved with a script in Acrobat, but not with my limited Javascript knowledge.

We also have Pitstop, but I couldn't find anyway to do this there either. I'm running Acrobat XI on the Mac and Acrobat 9 on the PC.

Any help would be appreciated!

Thanks in advance,

Lisa

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

129

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

Adding control number

New Here ,
Jul 05, 2017

Copy link to clipboard

Copied

Hi,

We have a customer that supplies large pdfs, sometimes up to 8000 pages, that they have created possibly with Word merge or a similar program. Every 4 pages is a new cover letter (or record).

I need to add a padded 4' Arial identifier (record number) that will show in the window of the envelope after the Letters are folded down.

Basically...

PDF p1 would have 0001

PDF p5 would have 0002

PDF p9 would have 0003

PDF p13 would have 0004

...and so forth

Currently I bring it into our variable program, Fusion Pro, and add it there, but it's very long composition.

I'm pretty sure this can be achieved with a script in Acrobat, but not with my limited Javascript knowledge.

We also have Pitstop, but I couldn't find anyway to do this there either. I'm running Acrobat XI on the Mac and Acrobat 9 on the PC.

Any help would be appreciated!

Thanks in advance,

Lisa

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

130

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
Jul 05, 2017 0
Adobe Community Professional ,
Jul 05, 2017

Copy link to clipboard

Copied

If it's always on each fourth page, you can use a script to add an annotation or a form field to the PDF file with the control number. To convert this dynamic content into static PDF content, you would then have to flatten each page that you've added that information to.

A script like this would work:

var p = 0;

var c = 1;

var inch = 72;

while (p < this.numPages) {

  // create control number with leading zeros

  var ctrlNr = c + "";

  while (ctrlNr.length < 5) {

  ctrlNr = "0" + ctrlNr;

  }

  // determine location on the page

  var aRect = this.getPageBox({

  nPage: p

  });

  aRect[0] += .5 * inch; // from upper left hand corner of page.

  aRect[2] = aRect[0] + .5 * inch; // Make it .5 inch wide

  aRect[1] -= .5 * inch;

  aRect[3] = aRect[1] - 24; // and 24 points high

  var f = this.addField("Ctrl_" + ctrlNr, "text", p, aRect);

  f.value = ctrlNr;

  this.flattenPages(p);

  p += 4;

  c++;

}

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
Reply
Loading...
Jul 05, 2017 1
New Here ,
Jul 06, 2017

Copy link to clipboard

Copied

Thank you so much Karl!

With a few tweaks, that is going to work exactly as I need it to.

Lisa

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
Reply
Loading...
Jul 06, 2017 0