5 Replies Latest reply on Jun 11, 2008 10:52 AM by (Edward_Gioja)

    addWatermarkFromFile in  livecycle

      In "Converting Acrobat® JavaScript for Use in LiveCycle Designer Forms" it says that doc.addWatermarkFromFile()

      Works in Livecycle designer
      Does NOT have a livecycle designer equivalent
      Has a ---- for LiveCycle designer javascript

      Does this mean I can or can not use this command? I use this command in Version 7 to place a picture of a signature on a form. When I try to use it on a LiveCycle form (doc = event.target), the console responds with:

      Exception in line 504 of function anonymous, script Folder-Level:App:config.js
      (504 being the addWatermarFromFile() command)

      If I open an older form (not LiveCycle), it works just fine.
        • 1. Re: addWatermarkFromFile in  livecycle
          Patrick Leckey Level 3
          I have successfully used it in LiveCycle Designer forms, but not in version 7 forms. Have you tried in a more current version of Designer?
          • 2. Re: addWatermarkFromFile in  livecycle
            Level 1
            My designer is 8.05.

            Perhaps you can tell me what I'm doing wrong. Here are two methods I've tried:

            Folder Level Javascript:

            AddWatermark = app.trustedFunction( function ( docptr)
            cDIPath: "/C/temp/A425.jpg" (I've also tried pdf)


            Menu that calls it:

            cName: "TestDesigner",
            cUser: "Test Designer Form",
            cParent: "Tools",
            cExec: "AddWatermark(event.target)"


            In the form itself, I've added a button.

            In the click action:

            event.target.addWatermarkFromFile({cDIPath: "/c/temp/A425.pdf"});

            I've tried wrapping the above in a beginPriv()/endPriv() but that causes an exception on the app.beginPriv()

            Thank you for your help.
            • 3. Re: addWatermarkFromFile in  livecycle
              Level 1
              BTW, when I was talking about version 7 I was just pointing out that the code works fine when I'm using an AcroForm as opposed to a LiveCycle form. This tells me, I think, that the syntax is correct.
              • 4. Re: addWatermarkFromFile in  livecycle
                Patrick Leckey Level 3
                You may want to clearly read the documentation. Note that for addWatermarkFromFile it says:

                Note:Can only be executed during a batch or console event.

                It DOES NOT say "application initialization" events, which is what folder-level scripts are. Your only options to run this method are during a batch sequence, from the console manually or via the JSObject from an external application.

                Just to make sure, I copied your code exactly (even put an A425.jpg in my C:\Temp directory) and executed it via the menu item. In the JavaScript console, I get the following error:

                NotAllowedError: Security settings prevent access to this property or method.
                Doc.addWatermarkFromFile:5:Menu TestDesigner:Exec

                I also tried with a certified document, still gives the security violation.
                • 5. Re: addWatermarkFromFile in  livecycle
                  Level 1
                  I was able to get around that, even according to the documentation, by putting it in a trusted function. That doesn't work anymore then?