JavaScript Scripting
3D JavaScript Overview
You can use JavaScript to do various things:
Create animations: Simulate a product in action, demonstrate an assembly and disassembly, illustrate the effects of one component upon another, or simulate camera movements around or through the model.
Interactive interactions: Let users take pieces out of a model, add pieces to it, or activate overlays, animations, or lighting changes.
Control Display Modes: Activate other files or modes. For example, you can display a 3D design as a wireframe, as nodes, in 2D, and so on.
You can set a JavaScript to start based on any action. For example, you can have it automatically start when a user opens the PDF, start when a user clicks a button or link in the PDF, or start based on another JavaScript file’s instructions.
For more information about using JavaScript with Acrobat, see these online resources: Acrobat JavaScript API Reference .
JavaScript tips and tutorials: Acrobat Users JavaScript Tutorials
Add a JavaScript to a PDF
When you embed a JavaScript file as part of a 3D model and then save the PDF, the JavaScript file becomes part of the PDF document.
Using the Select Object tool from the Advanced Editing toolbar, double-click the 3D annotation.
In the Edit 3D dialog box, on the 3D tab, select Browse in the Script section.
In the Select a Default Script dialog box, locate the JavaScript file and click Open.
By default, the embedded JavaScript runs when you activate the 3D model. You can also set page elements, such as buttons or links, to trigger the JavaScript.
Note: Instead of embedding the JavaScript file in the PDF, you can include it as a separate file that users load and run manually. Typically, recipients must save the JavaScript file to their local hard drive. To activate this script, the user right-clicks the 3D design, chooses Run a JavaScript, and then browses to select the JavaScript file. This approach runs the script but doesn’t save it with the image.