PDF Editing Issues

How to Use JavaScript to Hide, Show, or Move Objects in a 3D PDF

Steven ParkerSteven Parker Oct 28, 2026 869 views

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.

Using JavaScript to Hide, Show, or Move Objects in 3D PDFs
Product
PDF
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.
Before you start

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.

Solution 1Recommended

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).

1
Identify 3D Node Names

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.

2
Determine the Interaction Method

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).

3
Apply the JavaScript Code

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;'.

4
Test the 3D Interaction

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.

Determine the Interaction Type and Script the Model Structure
JavaScript Limitations: Complex 3D PDF scripting is highly specific to the PDF viewer. Scripts written for Acrobat's 3D API may not function in basic or third-party PDF readers that lack full 3D rendering support.

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. 1. Download WPS Office: Get the latest version of WPS Office from the official website and install it on your device.
  2. 2. Open Your PDF: Launch the application and open your standard PDF document directly in the WPS PDF editor.
  3. 3. Edit and Manage: Navigate to the Edit tab to quickly modify text, adjust images, or add annotations to your document.
  4. 4. Save or Convert: Save your changes securely or convert your PDF to a Word document for further extensive formatting.
Fast and lightweight PDF reader for standard 2D document workflows.High compatibility with standard Adobe PDFs and Microsoft Office formats (Word, Excel, PowerPoint).Native capabilities to edit text, insert images, and organize PDF pages.Free to download and completely free to use for basic daily document tasks.
microsoft office alternative - wps office

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.