0 Replies Latest reply on Nov 15, 2017 6:34 PM by kaorim49702983

    How can I open linked external PDF in existing window (javascript)??

    kaorim49702983

      Hi, all.

       

      This is my 2nd day fiddling with java script and I would appreciate any help.

       

      Here is what I want to do...

        Add links on each page which opens an external PDF file in existing window

       

      Here is the code

      -----------------------------

      var linkWidth = 36, linkHeight = 18;

       

      //get target PDF name

      var myname = this.documentFileName;

          myname = myname.slice(0,1);

      var my_target_pdf = myname + " Section illustration.pdf";

       

      //do it all pages

      for ( var i=0; i < this.numPages; i++)

      {

      var cropBox = this.getPageBox("Crop", i);

      var offsetLink = cropBox[2] - cropBox[0] - linkWidth;

      var linkRect2 = [602,linkHeight+550,linkWidth + offsetLink-32,550];

      var rhLink = this.addLink(i, linkRect2);

      app.openInPlace = true;

      rhLink.setAction("app.openDoc('" + my_target_pdf + "', this);" );

      }

      --------------------------------------

       

      It links to the external PDF, however it opens new window.

      Also my customer does not want to see security alert when the external PDF opens.

      So I don think I can use launchURL...

       

      Any help is really appreciated.

       

      Thank you!