2 Replies Latest reply on Aug 22, 2017 1:24 AM by thomasj54347878

    Problem with loop and addWatermarkFromFile


      Hello everyone


      I'd like to insert a PDF as a watermark on odd page numbers in a specific page range of another PDF. My problem with the code below is that the loop doesn't work. The watermark is always inserted on all pages of my target PDF (all 600 pages). Even if I replace the variables with fixed numbers, the watermark appears on all 600 pages.


      I have to say, that I'm a beginner regarding JavaScript. Here's my code:



      var nStart = 1;
      var nEnd = 11;
      function watermark() {
           cDIPath: "Register_DEU_Layerk_Rand.pdf",
           nSourcePage: 0,
      // nStart: 0,
      // nEnd: 11,
           nHorizAlign: app.constants.align.right,
           nVertAlign: 0,
      var p;
      for (var p = nStart - 1; p <= nEnd; p++)
           if (p%2==1) {


      Where's the problem?


      Thanks in advance.