2 Replies Latest reply on Jul 6, 2017 7:36 AM by mclisa1981

    Adding control number

    mclisa1981

      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

        • 1. Re: Adding control number
          Karl Heinz Kremer Adobe Community Professional

          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++;
          }
          
          1 person found this helpful
          • 2. Re: Adding control number
            mclisa1981 Level 1

            Thank you so much Karl!

             

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

             

            Lisa