13 Replies Latest reply on Dec 16, 2015 10:54 PM by arvindkumar7

    exportDataObject

    Sashikala Balasubramanian Level 1

      The exportDataObject returns error in Adobe Reader. I added the below code and created the JS file and included in Reader/Javascript folder.

       

      function exportXML()
      {
      var didprints=this.exportDataObject({cName:"myData",nLaunch:2}););
      this.setAction("WillPrint",didprints};
      }
      app.addMenuItem({cName:"Export_file",cParent:"View",cExec:"exportXML();"});

       

       

      The below code is not executing. Please me know what the problem might be?

       

      regards,

      Sashi

        • 1. Re: exportDataObject
          George_Johnson MVP & Adobe Community Professional

          What's the text of the error, exactly? Did you install that code in a  JavaScript file in the relevant folder for Reader, or are you just  attempting to use a document that you added the willPrint code to in  Reader?

           

          It looks like the function is attempting to add a script to a  document. The script needs to be a string for the second setAction  parameter. So the code would have to be:

           

          var didprints = "this.exportDataObject({cName:\"myData\",nLaunch:2});";

          this.setAction("WillPrint",didprints);

           

          Note the parens and bracket corrections.

          • 2. Re: exportDataObject
            try67 MVP & Adobe Community Professional

            Since this method returns nothing, how are you planning on using that as a script in the WillPrint event?

            Also, what is the exact error message you get, and which version of Reader is this?

            • 3. Re: exportDataObject
              Sashikala Balasubramanian Level 1

              Thanks. I corrected the codes as instructed. I installed the Javascript file in the relevant folder for Reader. The menu added 'Export file' is visible in Acrobat but

              not in Reader.

               

              I am not using the document where the willPrint code has been added to in Reader. Should we have to embed the code for WillPrint in Acrobat and then

              use the file in Reader.

               

              regards,

              Sashi

              • 4. Re: exportDataObject
                Sashikala Balasubramanian Level 1

                this.exportDataObject({cName:\"myData\",nLaunch:2});

                 

                I changed the cDIPath such that the attachment is saved to the local drive D:\test\ - this.exportDataObject({cName:"\d\test\myData\",nLaunch:2});

                This code returns the errors. Please let me know the exact syntax.

                 

                regards,

                Sashi

                • 5. Re: exportDataObject
                  Bernd Alheit Adobe Community Professional & MVP
                  Should we have to embed the code for WillPrint in Acrobat and then use the file in Reader.

                  Yes. The function setAction isn't available in Adobe Reader.

                  • 6. Re: exportDataObject
                    try67 MVP & Adobe Community Professional

                    You can't use setAction in Reader.

                     

                    On Thu, Jan 27, 2011 at 12:15 PM, Sashikala Balasubramanian <

                    • 7. Re: exportDataObject
                      Sashikala Balasubramanian Level 1

                      How to specify the path while exporting the attachment?

                       

                      Name of the data object i.e the attachment in the file is 'myData' and the attached file is test.xml

                       

                      this.exportDataObject({cName:"\d\test\myData\",nLaunch:2}); - This statement returns an error message. Please let me know the exact syntax to pass the directory path.

                       

                      regards,

                      Sashi

                       

                       

                       

                       

                       

                      • 8. Re: exportDataObject
                        gkaiseril MVP & Adobe Community Professional

                        The Acrobat JS API Reference's Quick Bar has an "S"  in the Security Column. The reference has the following statement regarding this notation:

                         

                         

                         

                        For security reasons, this property or method may be available only during certain events. These events include batch processing, application start, or execution within the console. (See the

                        event object for details of the Acrobat events.)

                        Beginning with Acrobat 7.0, to execute a security-restricted method through a menu event, one of the following must be true:

                        The JavaScript user preferences item Enable Menu Items JavaScript Execution Privileges is checked.

                        The method is executed through a trusted function. For details and examples, see the app.trustedFunction method.

                        See

                        "Privileged versus non-privileged context" on page 32 for more information.

                        Note:

                         

                         

                         

                        (Acrobat 6.0 or later) Methods marked with S will execute without restriction in a certified document provided the certifier’s certificate is trusted for running embedded high privilege JavaScript and other limitations in the quick bar fields are met.

                        • 9. Re: exportDataObject
                          Sashikala Balasubramanian Level 1

                          When i select the 'Print' optioni need to export the attachment (xml file) in the pdf via DidPrint action.

                           

                          I am able to export the attachment but while passing the cDIPath for the exportDataObject, the file is not gettting saved. I tried the below 2 methods.

                           

                          Code:

                           

                          1.

                           

                          this.exportDataObject("myData","/d/temp/test.xml");

                           

                          2.

                          trustedActiveDocs=app.trustedFunction
                          {
                          function()
                          {
                          app.beginPriv();
                          this.exportDataObject({cName:"myData",cDIPath:"/d/temp/test.xml");
                          app.endPriv();
                          }
                          }

                           

                          Please let me know the exact syntax.

                           

                          regards,

                          Sashi

                          • 10. Re: exportDataObject
                            George_Johnson MVP & Adobe Community Professional

                            You cannot specify a path with this method, as documented in the Acrobat JavaScript reference. Support for the cDIPath parameter was dropped long ago.

                            • 11. Re: exportDataObject
                              arvindkumar7 Level 1

                              Hi George,

                               

                              Thanks for this info, just need to confirm even if run in privileged manner this would not work to exportdataobject with a fixed path silently.

                               

                              Thanks

                              Arvind

                              • 12. Re: exportDataObject
                                try67 MVP & Adobe Community Professional

                                Correct. You can't do it at all.

                                • 13. Re: exportDataObject
                                  arvindkumar7 Level 1

                                  Thank you Gilad for this info.