0 Replies Latest reply on Aug 15, 2008 1:47 PM by (Tracy_Todd)

    Question - How to Revise a Javascript for Printing a Dynamic Date in the Right Corner of the Page

      Hi Everyone,

      I am using Adobe Professional 8.0.

      How do I revise the JavaScript (not created by me) below in order to execute the two (2) following changes:

      1) Dynamic Print Date - 1.0 inch Up and 1.0 inch Over from the Right Corner of the Page.

      2) Dynamic Print Date - 0.5 inch Up and 1.0 inch Over from the Right Corner of the Page.

      The JavaScript I want to revise is the following:

      /* Put script title here */
      // Add field to each page of form
      var inch = 72;

      for (var p = 0; p < this.numPages; p++) {
      // create rectangle quads for field
      var aRect = this.getPageBox( {nPage: p} );
      aRect[1] = 1.0*inch;
      aRect[3] = aRect[1] - 72; // and 24 points high

      // now construct text field to fill with date information
      var f = this.addField("PrintField", "text", p, aRect )
      f.delay = true;
      f.textSize = 10;
      f.textFont="Arial,Bold";
      f.textColor = color.black;
      f.alignment = "right";
      f.readonly = true;
      f.print = true;
      f.hidden = true;
      f.delay = false;
      }

      var myWillPrintScript = 'var f = this.getField("PrintField"); \r'
      + 'f.hidden = false; \r'
      + 'var d = new Date(); \r'
      + 'var year = d.getYear()+1900; \r'
      + 'f.value = "Print Out Date:" + (d.getMonth()+1) + "/" + d.getDate() + "/" + year; \r';

      var myDidPrintScript = 'var f = this.getField("PrintField"); \r'
      + 'f.value = ""; \r'
      + 'f.hidden = true; \r';


      this.setAction("WillPrint", myWillPrintScript);
      this.setAction("DidPrint", myDidPrintScript);

      Thank you for your help!

      Tracy