4 Replies Latest reply on Jul 21, 2017 6:03 AM by shallberg7

    I want to use a script to open a file and then add a watermark in one step

    shallberg7

      I want to use a script to open a file and then add a watermark in one step. I have a script that, when simplified, looks like this:

       

      app.openDoc("filepath");

      this.addWatermarkFromFile("filepath");

       

      When I have acrobat opened to the home menu with no files open and run this script, it opens the file perfectly but doesn't add the watermark. It returns the error "this.addWatermarkFromFile is not a function". However, if i leave the document open after running it the first time and run it again it adds the watermark with no error. This rules out any filepath errors, since both lines work just not at the same time.

       

      Here's the main question:

       

      What is causing the "addWatermarkFromFile" function to fail the first time, but not the second? How do I fix it?

       

      Adding a document level script to run upon opening the document would not be beneficial for what I'm trying to do here.

       

      Thanks