open an attahced pdf on click of a part in 3d model

New Here ,
Jul 27, 2017

Copy link to clipboard

Copied

I want to open an attached pdf when i click on a part of 3d model.

when i try host.exportDataObject({ cName: "MindSphere_GettingStarted.pdf", nLaunch: 2 }); it throws an error

this is my complete code:

//start

var myMouseHandler = function( event ) {

if ( event.isMouseUp ) {

var myMesh = null;

if ( event.hits.length > 0 ) {

myMesh = event.hits[0].target;

}

if ( myMesh != null ) {

host.exportDataObject({ cName: "MindSphere_GettingStarted.pdf", nLaunch: 2 });

}

}

}

var mouseEventHandler = new MouseEventHandler();

mouseEventHandler.onMouseDown = false;

mouseEventHandler.onMouseMove = false;

mouseEventHandler.onMouseUp = true;

mouseEventHandler.onEvent = myMouseHandler;

runtime.addEventHandler( mouseEventHandler );

TOPICS
Acrobat SDK and JavaScript, Windows

Views

204

Likes

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

open an attahced pdf on click of a part in 3d model

New Here ,
Jul 27, 2017

Copy link to clipboard

Copied

I want to open an attached pdf when i click on a part of 3d model.

when i try host.exportDataObject({ cName: "MindSphere_GettingStarted.pdf", nLaunch: 2 }); it throws an error

this is my complete code:

//start

var myMouseHandler = function( event ) {

if ( event.isMouseUp ) {

var myMesh = null;

if ( event.hits.length > 0 ) {

myMesh = event.hits[0].target;

}

if ( myMesh != null ) {

host.exportDataObject({ cName: "MindSphere_GettingStarted.pdf", nLaunch: 2 });

}

}

}

var mouseEventHandler = new MouseEventHandler();

mouseEventHandler.onMouseDown = false;

mouseEventHandler.onMouseMove = false;

mouseEventHandler.onMouseUp = true;

mouseEventHandler.onEvent = myMouseHandler;

runtime.addEventHandler( mouseEventHandler );

TOPICS
Acrobat SDK and JavaScript, Windows

Views

205

Likes

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
Jul 27, 2017 0
Most Valuable Participant ,
Jul 27, 2017

Copy link to clipboard

Copied

What does the error message say?

Likes

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
Reply
Loading...
Jul 27, 2017 0
New Here ,
Jul 27, 2017

Copy link to clipboard

Copied

TypeError: Invalid argument type.

Doc.exportDataObject:0:Doc undefined:Exec

===> Parameter cName.Line: 20: Code: -36(0xffffffdc): Not implemented

Likes

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
Reply
Loading...
Jul 27, 2017 0
Most Valuable Participant ,
Jul 27, 2017

Copy link to clipboard

Copied

Are you sure the name you specified is correct?

Open the file in Acrobat and execute this code from the JS-Console:

this.dataObjects

What is the output?

Likes

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
Reply
Loading...
Jul 27, 2017 0
New Here ,
Jul 27, 2017

Copy link to clipboard

Copied

When i try

this.exportDataObject({ cName: "MindSphere_GettingStarted.pdf", nLaunch: 2 }):

In console, pdf gets opened, but when i try in the script it doesnt work

Likes

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
Reply
Loading...
Jul 27, 2017 0
Most Valuable Participant ,
Jul 27, 2017

Copy link to clipboard

Copied

Are you sure the "host" variable is referencing the Document object?

Likes

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
Reply
Loading...
Jul 27, 2017 0
New Here ,
Jul 27, 2017

Copy link to clipboard

Copied

looks like... i have given host.app.alert(host); and the result is in the snapshot

Likes

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
Reply
Loading...
Jul 27, 2017 0
try67 LATEST
Most Valuable Participant ,
Jul 27, 2017

Copy link to clipboard

Copied

Maybe there's some kind of undocumented restriction on executing this command from the 3D context... I'm not sure.

Likes

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
Reply
Loading...
Jul 27, 2017 0