1 2 Previous Next 55 Replies Latest reply on Oct 31, 2016 9:50 AM by Test Screen Name

    Dynamic Date On Printouts - Saving Routine

    SimplyOtto Level 1

      Hello everybody.

      To add a field with a dynamic date + "expiry date" i used this script:

       

      var inch = 72;

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

      var aRect = this.getPageBox( {nPage: p} );

      aRect[1] = .5*inch;

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

       

      var f = this.addField("PrintField", "text", p, aRect )

      f.delay = true;

      f.textSize = 10;

      f.textFont = font.Cour;

      f.textColor = color.black;

      f.alignment = "center";

      f.readonly = true;

      f.display = display.noView;

      f.delay = false;

      }

       

      var d = new Date();

      d.setDate(d.getDate()+3);

      this.getField("PrintField").value = "Dokument gültig bis " + util.printd("dd.mmm.yyyy", d);

       

      this.setAction("WillPrint", myWillPrintScript);

       

      It works pretty well, but i have an issue about the need to save the file each time i print it.

      Is there a way to avoid the saving (as no changes are made to the document...) or as a workaround

      to automize the saving-procedure?

       

      Another thing, is there a way to forbid users to make changes to an implemented java script?

       

      Thanks in advance,

      Otto

        1 2 Previous Next