How to Use JavaScript to Hide, Show, or Move Objects in a 3D PDF
Question details
The user wants to know if JavaScript can be used to hide, show, or move specific node objects within a 3D PDF that contains PRC content.

- Product
- Device & OS
- not provided
- Scenario
- Attempting to create interactive or animated 3D models embedded in a PDF document using scripts.
- Observed behavior
- Requires identifying whether the required behavior is continuous animation or object movement triggered by specific mouse actions, as this dictates the correct scripting approach.
Verify that your PDF viewer has 3D content and JavaScript execution enabled in its security preferences, and ensure you know the exact node names within your 3D model hierarchy.
Determine the Interaction Type and Script the Model Structure
Identify the goal of your script (mouse-triggered interactions vs. continuous animation) and apply the appropriate 3D JavaScript API methods to manipulate the model nodes.
Manipulating PRC content within a 3D PDF depends heavily on the internal structure of the 3D model and the JavaScript capabilities of your PDF viewer. The approach differs based on whether you want the object to move autonomously (animation) or respond to user inputs (mouse events).
Open the 3D model tree panel in your advanced PDF authoring software (like Adobe Acrobat) to find the exact names of the nodes or meshes you wish to manipulate.
Decide if your requirement is time-based animation (which requires the TimeEventHandler) or event-driven movement based on mouse actions (which requires mouse event listeners).
Use the built-in 3D JavaScript API to manipulate the object. For example, to hide a specific part, you can use a script like 'scene.meshes.getNodeByName("YourNodeName").visible = false;'.
Save your PDF document, close the script editor, and interact with the 3D model using your mouse to verify that the nodes hide, show, or move exactly as programmed.

Manage and Edit Standard PDFs Easily with WPS Office
While advanced 3D PDF scripting requires specialized 3D CAD PDF authoring tools, WPS Office provides a lightweight, highly compatible, and feature-rich environment for all your standard PDF reading, editing, and form-filling needs.
- 1. Download WPS Office: Get the latest version of WPS Office from the official website and install it on your device.
- 2. Open Your PDF: Launch the application and open your standard PDF document directly in the WPS PDF editor.
- 3. Edit and Manage: Navigate to the Edit tab to quickly modify text, adjust images, or add annotations to your document.
- 4. Save or Convert: Save your changes securely or convert your PDF to a Word document for further extensive formatting.

Frequently Asked Questions
Can standard PDF readers execute 3D JavaScript?
Most standard or web-based PDF readers disable or lack support for 3D content and 3D JavaScript APIs. You generally need advanced software like Adobe Acrobat Pro to author and run complex 3D scripts.
What is PRC content in a 3D PDF?
PRC (Product Representation Compact) is a specialized 3D file format embedded within PDFs. It stores highly compressed and precise 3D CAD data, preserving product structures that can be interacted with via JavaScript.
How do I hide a specific object using a 3D PDF script?
You must access the 3D scene's object tree via JavaScript and set the specific node's visibility property to false. You can usually accomplish this by referencing the node by its exact name.
Why isn't my 3D PDF animation working?
Animations may fail if 3D content is not trusted or enabled in your viewer's security preferences. Additionally, ensure your JavaScript syntax is completely error-free and correctly references existing node names in your model's hierarchy.




