title: Split Long Filename string in two Lines with Adobe Javascript
body: <p>I am newbie using Javascript in Adobe. I have written script that catch the file name and add it as a title in the document, but problem is it doesn't split in 2 lines long file names. So long text file names are out of the page border.</p>
  
  <p>For example file name is 
  "This is a text that I need to split in two lines How to write the script in order to split the long text and fit in the page"</p>
  
  <p>This is just a sample. What I need to edit? And is it possible?</p>
  
  <pre><code>var trFileName = this.documentFileName.replace(/.*\/|\.pdf$/ig,""); //remove .pdf extension
  var pageAmount = this.numPages; //define how many pages are there
  
  this.addWatermarkFromText({
  cText: trFileName,
  nStart: 0,
  nEnd: pageAmount,
  nFontSize: 18,
  aColor: color.blue,
  cFont: "Helvetica-Bold",
  nTextAlign: app.constants.align.center,
  nHorizAlign: app.constants.align.center,
  nVertAlign: app.constants.align.top,
  //nHorizValue: -25, 
  nVertValue: -87.87
  })
  </code></pre>