Skip to main content
mclisa1981
Participant
July 5, 2017
Question

Adding control number

  • July 5, 2017
  • 1 reply
  • 389 views

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

This topic has been closed for replies.

1 reply

Karl Heinz  Kremer
Community Expert
Community Expert
July 5, 2017

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++;

}

mclisa1981
Participant
July 6, 2017

Thank you so much Karl!

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

Lisa