2 Replies Latest reply on May 30, 2012 9:49 PM by _screen_name_

    Need to change font size of automated bates number (watermark)

    _screen_name_

      I used the following javascript by Try67 to add the file name and page numbers to my documents:

       

      for (var p=0; p<this.numPages; p++) {
          this.addWatermarkFromText({
              cText: this.documentFileName.replace(/\.pdf/i,"") + " " + (p+1),
              nTextAlign: app.constants.align.right,
              nHorizAlign: app.constants.align.center,
              nVertAlign: app.constants.align.bottom,
              nVertValue: 14,

              nStart: p
          });
      }

       

      However, I'd like to change the font size to something a little smaller.

       

      I tried guessing at the correct code before posting ("textSize: 4,", "this.textSize: 4,", etc), but nothing worked.

       

      Can anyone help me?

       

      I'm also unsure where I can get a list of the parameters for text (nHorizAlign, nVertAlign, etc) so if anyone has a refernce page, that'd be great too.

       

      Thankyou in advance!

        • 1. Re: Need to change font size of automated bates number (watermark)
          _screen_name_ Level 1

          Just an update, I found some information on watermark properties which I've pasted at the bottom of this post for everyone's reference (the link goes through to source website). The cFontSize property isn't working for me though (my addition is in blue).

           

          If someone can see where I've gone wrong, please let me know. Thanks!

           

           

          for (var p=0; p<this.numPages; p++) {

              this.addWatermarkFromText({

                  cText: this.documentFileName.replace(/\.pdf/i,"") + " " + (p+1),

                  cFontSize: 6,

                  nTextAlign: app.constants.align.right,

                  nHorizAlign: app.constants.align.center,

                  nVertAlign: app.constants.align.bottom,

                  nVertValue: 14,

           

                  nStart: p

              });

          }

           

           


          Quoted from: http://www.verydoc.com/documents/acrojsguide/pg_0135.htm :

           

          You may use Acrobat JavaScript to add headers and footers to your documents. For example, you may use the doc object’s addWatermarkFromText method, which has several properties useful for this specific purpose:

           

          cText: The actual text displayed in the header or footer.

          nTextAlign: How the text is aligned in the header or footer.

          vTextAlign: How the watermark is aligned vertically: a value of 0 aligns it at the top of the page (header), and a value of 2 aligns it at the bottom of the page (footer).

          nStart: The starting page for the watermark. A value of -1 causes the resultant header or footer to appear on every page of the document.

           

          There are several properties to the doc object’s watermark addition methods useful for controlling font, size, placement, rotation and opacity. These are listed below:

           

          cFont: The font name.

          cFontSize: The font size (in points).

          nTextAlign: The text alignment.

          nRotation: The rotation in degrees.

          nOpacity: The opacity from 0.0 to 1.0, where 0 means transparent and 1 means opaque.

          • 2. Re: Need to change font size of automated bates number (watermark)
            _screen_name_ Level 1

            I figured it out. the correct property name is nFontSize:

             

            The correct code for Acrobat 9 is:

             

            for (var p=0; p<this.numPages; p++) {

                this.addWatermarkFromText({

                    cText: this.documentFileName.replace(/\.pdf/i,"") + " " + (p+1),

                    nFontSize: 6,

                    nTextAlign: app.constants.align.right,

                    nHorizAlign: app.constants.align.center,

                    nVertAlign: app.constants.align.bottom,

                    nVertValue: 14,

             

                    nStart: p

                });

            }