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 );
Copy link to clipboard
Copied
What does the error message say?
Copy link to clipboard
Copied
TypeError: Invalid argument type.
Doc.exportDataObject:0:Doc undefined:Exec
===> Parameter cName.Line: 20: Code: -36(0xffffffdc): Not implemented
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?
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
Copy link to clipboard
Copied
Are you sure the "host" variable is referencing the Document object?
Copy link to clipboard
Copied
looks like... i have given host.app.alert(host); and the result is in the snapshot
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now