7 Replies Latest reply on Oct 29, 2014 9:53 PM by MichaelN

    Add text to PDF based on File name

    Verlorst Level 1

      Hi Everyone,


      I am trying to set up an action sequence that will take the file name and insert it into the PDF document at various places.


      I have the following code which works to an extent but ere is the kicker......the text needs to be coloured, moveable and if possible editable


      // Add file name to footer
      var re = /.*\/|\.pdf$/ig;
      var FileNM = this.path.replace(re,"")+".pdf";
      var Path = this.path;
      var AcDate = new Date(); 
      var AcDateFormat = "yyyy/mmm/dd  HH:MM" 
      var Box2Width = 50
      for (var p = 0; p < this.numPages; p++){
      var aRect = this.getPageBox("Crop",p); 
      var TotWidth = aRect[2] - aRect[0] 
             var fd = this.addField("xftDate", "text", p, [30,15,TotWidth-30-30,30]); 
             fd.value =  FileNM.substring(0,20); 
             fd.textSize=8; fd.readonly = true; 
      var bStart=(0); 
      var bEnd=(TotWidth);


      The above code was found via google so its probably not all needed or efficient


      Any help would be grand