6 Replies Latest reply on Jan 26, 2010 6:19 AM by try67

    Opening pdf within a pdf problem…ongoing

    SH6

      Hello,

       

      I posted a issue yesterday regarding how to action opening an attached pdf within a pdf and “Try67” very kindly offered help by using the openDataObject() scripting to achieve this. This may seem a basic question as I don’t know javascript at the moment at all and have tried typing the code and the name of the report within the brackets. The attached pdf I want to open into another window. The script is openDataObject("European Report.pdf");

       

      What I want to achieve is have an icon of a report within the text in the main pdf and so when this icon is pressed it opens this attached report into its own window, but I can’t get the code to work. Help.

       

      I have tried looking up tutorials but can’t find anything. Hope someone can help?

       

      Thanks in advance for your help

        • 1. Re: Opening pdf within a pdf problem…ongoing
          try67 MVP & Adobe Community Professional

          (You can post a reply to your original thread, instead of opening a new one)

           

          The name of the DataObject is not necessarily the same as the file's name.

          You can use the dataObjects property of the Document object to get all the

          names of the DO's for that file. There's actually a sample script that does

          just that in the reference files. Here it is:

           

          var d = this.dataObjects;

          for (var i = 0; i < d.length; i++)

          console.println("Data Object[" + i + "]=" + d[i].name);

          • 2. Re: Opening pdf within a pdf problem…ongoing
            SH6 Level 1

            Many Thanks again for your reply, I didn’t realise you can use the same thread.

             

            Just to say I am working in acrobat 9 pro

             

            Sorry in laymans terms if I had a host file called report 1 and an attached file called report 2 how would point to that in the code?

             

            Would it be:?

             

            var d = this.dataObjects;
            for (var i = 0; i < d.length; i++)
            console.println("Data Object[" + i + "]=" + d[i].report2);

            • 3. Re: Opening pdf within a pdf problem…ongoing
              try67 MVP & Adobe Community Professional

              No, just run the code as I posted it (don't change it!) in the console

              (Ctrl+J, paste the code, select it, press the Enter at the bottom-right of

              the keyboard), and it will show you the names of all the Data Objects in the

              currently opened file).

              • 4. Re: Opening pdf within a pdf problem…ongoing
                SH6 Level 1

                Thanks, I have pasted the code in the console in the javascript debugger (Command J on mac) pressed return and I get the following message? I do have a file attached but it doesn’t seem to show anything?

                 

                 

                vvar d = this.dataObjects;

                for (var i = 0; i < d.length; i++)

                console.println("Data Object[" + i + "]=" + d[i].name);

                missing ; before statement

                1:Console:Exec

                undefined

                • 5. Re: Opening pdf within a pdf problem…ongoing
                  try67 MVP & Adobe Community Professional

                  You've added an extra "v" in the beginning of the first line.

                  • 6. Re: Opening pdf within a pdf problem…ongoing
                    SH6 Level 1

                    Opps, I have run it again and I get the message below, do you know what this means?

                     

                    var d = this.dataObjects;

                    for (var i = 0; i < d.length; i++)

                    console.println("Data Object[" + i + "]=" + d[i].name);

                    d[i] has no properties

                    1:Console:Exec

                    undefined

                     

                    Many thanks for all your help