• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Nov 15, 2017 Nov 15, 2017

Copy link to clipboard

Copied

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!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

220

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation