Acrobat 3D JavaScript API Guide
Acrobat 3D JavaScript API Guide
Preface .......................................................................................................................................... 8
What’s in this guide? ..................................................................................................................................................................... 8
Who should read this guide? ..................................................................................................................................................... 8
Related documentation ............................................................................................................................................................... 8
1 Introduction ................................................................................................................................. 9
Object overview............................................................................................................................................................................10
Basic objects ............................................................................................................................................................................10
Scene object ............................................................................................................................................................................10
Canvas object ..........................................................................................................................................................................10
Runtime object .......................................................................................................................................................................11
Console object ........................................................................................................................................................................11
Resource objects ....................................................................................................................................................................11
Event handlers ........................................................................................................................................................................11
CamaraEvent............................................................................................................................................................................11
KeyEvent....................................................................................................................................................................................12
MenuEvent ...............................................................................................................................................................................12
MouseEvent .............................................................................................................................................................................12
RenderEvent.............................................................................................................................................................................12
ScrollWheelEvent ...................................................................................................................................................................13
SelectionEvent ........................................................................................................................................................................13
TimeEvent.................................................................................................................................................................................13
ToolEvent ..................................................................................................................................................................................13
2 JavaScript Objects for Acrobat 3D ........................................................................................... 14
Animation .......................................................................................................................................................................................15
Background ....................................................................................................................................................................................16
getColor.....................................................................................................................................................................................16
getImage...................................................................................................................................................................................16
setColor......................................................................................................................................................................................16
setImage....................................................................................................................................................................................17
Bone ..................................................................................................................................................................................................18
BoundingBox .................................................................................................................................................................................19
Camera .............................................................................................................................................................................................20
getScreenFromPosition .......................................................................................................................................................21
getDirectionFromScreen.....................................................................................................................................................22
CameraEvent..................................................................................................................................................................................23
CameraEventHandler..................................................................................................................................................................24
CameraEventHandler ...........................................................................................................................................................24
onEvent......................................................................................................................................................................................24
Canvas ..............................................................................................................................................................................................25
getCamera ................................................................................................................................................................................25
setCamera.................................................................................................................................................................................25
ClippingPlane ................................................................................................................................................................................26
remove.......................................................................................................................................................................................26
3
Adobe Acrobat SDK Contents
JavaScript for Acrobat 3D Annotations API Reference 4
The JavaScript™ API allows you to manipulate 3D annotations within Adobe® PDF documents.
Related documentation
This document refers to the following sources for additional information about 3D annotations, JavaScript
and related technologies. The Adobe Acrobat® documentation is available through the Acrobat Family
Developer Center, [Link]
Document Description
Developing Acrobat Applications Using JavaScript to develop and enhance standard workflows in
Using JavaScript Acrobat and Adobe Reader®.
JavaScript for Acrobat API Reference Detailed descriptions of JavaScript APIs for developing and
enhancing workflows in Acrobat and Adobe Reader.
8
1 Introduction
To create 3D annotations and to attach scripts to them using this API, you will need Adobe® Acrobat®
Professional and Acrobat 3D. Scripts attached to 3D annotations can run on Acrobat Professional,
Acrobat Standard, and Adobe Reader® for Windows® and Mac OS® platforms. Unless otherwise noted, all
JavaScript objects, properties, and methods have support starting in version 7.0.
The 3D JavaScript engine, which is distinct from the JavaScript engine for Acrobat, can be accessed in one
of two ways. The primary way is by attaching a default script to the 3D annotation. This can be
accomplished while placing a 3D annotation using the 3D Tool or on an existing 3D annotation by
accessing its properties dialog box using the Select Object tool. This script will be run directly by the 3D
JavaScript engine.
In addition, Acrobat provides a mechanism to directly access the entire 3D JavaScript engine API from
within the Acrobat scripting engine by means of the JavaScript Annot3D.context3D property. For more
details about JavaScript for Acrobat and its Annot3D object, see the JavaScript for Acrobat API Reference
and Developing Acrobat Applications Using JavaScript.
The following example illustrates how to access the 3D JavaScript engine. In this example, a button (or
link) contains JavaScript code that rotates the U3D object named "Axes".
// Get index of page containing the Annot3D object (count starts at 0).
pageIndex = [Link];
// Rotate the object about the X-Axis PI/6 radians (30 degrees).
[Link]( [Link] / 6 );
More extensive actions can be executed by having a button or link get the SceneContext3d object and
call a function defined in the default script of the 3D annotation, as in the following example.
// Get the Annot3D script context of the targeted annot.
context3D = getAnnots3D(0)[0].context3D;
9
Adobe Acrobat SDK Introduction
JavaScript for Acrobat 3D Annotations API Reference Object overview 10
Object overview
This section provides an overview of the objects in the 3D JavaScript API.
Basic objects
There are several basic objects, such as Color, Matrix4x4, and Vector3, that are used to create
general-purpose objects. The basic objects are used throughout the API and are only meaningful when
attached to objects such as Scene or Runtime. For example, you could create a Color object and use it
to set the Background color of a Canvas.
Vector3 Examples
v1 = new Vector3( 1.2, 3, 4.5 );
v2 = new Vector3( 5, 8, 13 );
v3 = new Vector3();
Matrix4x4 Examples
m1 = new Matrix4x4().rotateAboutX([Link]/1.5).rotateAboutY([Link]/3);
m2 = new Matrix4x4().rotateAboutZ([Link]/4).translate(new Vector3(0,5,0));
m3 = new Matrix4x4(m1);
Color Examples
c1 = new Color( 0.6, 0.8, 1.0 ); // light blue
c2 = new Color( 0.5, 0.5, 0.5 ); // middle grey
c3 = new Color(); //black
Scene object
The Scene is an object that contains all of the 3D-related content. It can be accessed using the global variable
scene, which is a reference to the main Scene object. Most of the contents of the Scene are structured into
a hierarchy of Node objects, and maintains lists of all these objects in the form of a SceneObjectList.
Canvas object
Represents a rectangular region into which a Scene is rendered from a particular viewpoint.
Runtime object
The Runtime object is used to represent the instance of the playback engine. It manages all event
processing and places where the graphic and textual content is rendered. It is accessed via the global
variable runtime, which is a reference to the main Runtime object.
Console object
The Console is the Acrobat text output area. It is helpful in debugging scripts.
Resource objects
Some objects, such as Image, are driven by content that is streamed from a file or over a network. To
create an Image, load a .png, .jpg, or .gif file as a Resource, which you may subsequently use to create a
new Image object, as shown in the following example:
faceRes = new Resource("pdf://[Link]");
faceImage = new Image( faceRes );
aMaterial = [Link](0).material;
[Link]( faceImage );
The Resource and Image objects are covered on page 66 and page 33, respectively.
Event handlers
There are several types of event handlers:
● CameraEventHandler
● KeyEventHandler
● MouseEventHandler
● MenuEventHandler
● RenderEventHandler
● ScrollWheelEventHandler
● SelectionEventHandler
● TimeEventHandler
● ToolEventHandler
Each one responds to a different type of event during simulation. They use a callback mechanism to run a
function when an event occurs. The event is passed as an argument to the event handler’s onEvent
function so that it can be queried when the function runs. Event handlers are registered via the
addEventHandler method, page 71, of the Runtime object.
CamaraEvent
A CamaraEvent is created when a View is selected.
KeyEvent
A KeyEvent is created when a key is pressed or released while the 3D Canvas is in focus. The following
example illustrates how to handle a key event:
myKeyHandler = new KeyEventHandler();
[Link] = function( event )
{
[Link]( "Key pressed with code: " + [Link] );
}
[Link]( myKeyHandler );
MenuEvent
A MenuEvent is created when a custom menu item is selected. To create a custom menu item on the
context menu, invoke the Runtime object’s addCustomMenuItem method, which allows a script to be
attached to the item selection event.
For more information, see MenuEvent on page 50.
MouseEvent
A MouseEvent is created when the mouse is clicked on an active 3D Canvas or the cursor moves over an
active 3D Canvas. The following syntax could be used to handle a mouse event:
myMouseHandler = new MouseEventHandler();
[Link] = true;
[Link] = [Link](0);
[Link] = function( event )
{
[Link]( "Mouse down at pixel " + [Link] );
[Link]( ", " + [Link] );
}
[Link]( myMouseHandler );
RenderEvent
A RenderEvent is created immediately before an instance of the Canvas is drawn. If there is a split view
in Acrobat resulting in two visible 3D rendered areas, a unique RenderEvent will be called for each of
them. This is necessary in the case of a camera-aligned image (sprite) in the 3D content that needs to be
pixel-aligned. Since the pixel dimensions of the two areas are possibly different, there are two callbacks
that pass the different dimensions. This makes it possible to modify the Scene in the appropriate manner
before it is drawn.
ScrollWheelEvent
A ScrollWheelEvent object is created when the mouse scroll wheel is activated over an active 3D
Canvas object.
SelectionEvent
A SelectionEvent object is created when an object is selected from an active 3D Canvas object or
from a model tree. If the selection is made from a Canvas object, a MouseEvent is also created.
TimeEvent
A TimeEvent is created when the 3D annotation is enabled and simulation is active. The time and
deltaTime properties are measured in terms of simulation time, not real time. TimeEvent objects are
used to drive animation. If you need an accurate, real-time measurement, use the JavaScript Date object.
The following syntax is used to handle a time event:
myTimeHandler = new TimeEventHandler();
[Link] = function( event )
{
[Link]( "Current simulation time is:" + [Link] );
[Link]( " second(s)" );
}
[Link]( myTimeHandler );
ToolEvent
A ToolEvent is created when a tool is clicked in the Acrobat 3D toolbar. The Runtime object’s
addCustomToolButton method allows you to add a custom tool to the toolbar which will also be
generated, and allows a script to be attached to the tool selection event.
Animation MouseEvent
Background MouseEventHandler
Bone Node
BoundingBox Procedural
Camera Quaternion
CameraEvent RenderEvent
CameraEventHandler RenderEventHandler
Canvas RenderOptions
ClippingPlane Resource
Color Runtime
Console Scene
Dummy SceneObject
HitInfo SceneObjectList
Host ScrollWheelEvent
Image ScrollWheelEventHandler
KeyEvent SelectionEvent
KeyEventHandler SelectionEventHandler
Light Texture
Material TimeEvent
Matrix4x4 TimeEventHandler
MenuEvent ToolEvent
MenuEventHandler ToolEventHandler
Mesh Vector3
Note: A property labeled as read-only is one whose value cannot be set. An object labeled as read-only is
one whose reference cannot be modified, though the object itself can be set and its properties may
be modified. Unless otherwise indicated, all properties and objects are assumed to have read/write
access.
14
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Animation 15
Animation
A type of SceneObject, page 83, used to store keyframe animation sequences of Node objects in the
Scene. In addition to the methods and properties below, it also contains the same methods and properties
as a SceneObject.
Properties
Property Type Access Description
currentTime number The current time measured in seconds.
endTime number read-only The end time of the sequence, measured
in seconds.
framesPerSecond number read-only The number of frames per second used to
author the sequence.
length number read-only The length of the Animation, measured in
seconds.
startTime number read-only The start time of the sequence, measured in
seconds.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Background 16
Background
Represents the background of a Canvas. It can be used as a target of a MouseEventHandler.
For information on the Canvas and MouseEventHandler, see page 25 and page 55, respectively.
Properties
Property Type Access Description
image Image Acrobat 7.0.7
The Image to be used by the Background.
getColor
Obtains the background Color.
Syntax
getColor()
Returns
A Color object representing the background color of the Canvas.
getImage
Deprecated
Syntax
getImage()
Returns
An Image object representing the background image of the Canvas.
setColor
Sets the background Color. If only one color is passed to this method, the background is a constant color.
If two colors are passed to this method, the background will be a linear gradient from top to bottom, with
the first color argument representing the top color and the second representing the bottom color.
Syntax
setColor(topColor, bottomColor)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference setImage 17
Parameters
topColor A Color object representing the desired background color. If bottomColor is
used, topColor represents the top background color used in a linear gradient.
bottomColor (Optional) A Color object representing the bottom background color used in a
linear gradient.
Returns
undefined
setImage
Deprecated
Syntax
setImage(image)
Parameters
image An Image object representing the desired background image.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Bone 18
Bone
A type of Node used to modify the shape of a Mesh, and is usually moved over time to create animated
characters. It contains the same methods and properties as a Node.
BoundingBox
Represents an axis-aligned bounding box.
Properties
Property Type Access Description
center Vector3 read-only Acrobat 7.0.7
The coordinates of the BoundingBox center.
max Vector3 read-only The coordinates of the BoundingBox corner with the
greatest x, y, and z values.
min Vector3 read-only The coordinates of the BoundingBox corner with the
smallest x, y, and z values.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Camera 20
Camera
A Node that controls the projection from world space to screen space. In addition to the methods and
properties below, it also contains the same methods and properties as a Node. (See Node on page 57.)
Properties
Property Type Access Description
binding string The view plane calculation type, which can take
one of the following values:
● "min"
● "max"
● "horizontal"
● "vertical"
BINDING_HORIZONTAL string read- Acrobat 7.0.7
only A string constant for the binding value of
"horizontal".
BINDING_MAX string read- Acrobat 7.0.7
only A string constant for the binding value of "max".
BINDING_MIN string read- Acrobat 7.0.7
only A string constant for the binding value of "min".
BINDING_VERTICAL string read- Acrobat 7.0.7
only A string constant for the binding value of
"vertical".
far number The distance from the Camera to the far clipping
plane. A value of -1 for both near and far
signifies to use auto clipping plane calculations.
fov number The size of the field of view for perspective
Camera objects, measured in radians.
getScreenFromPosition
Obtains the screen coordinates of the provided 3D position.
Syntax
getScreenFromPosition(position, canvasWidth, canvasHeight)
Parameters
position A Vector3 object representing the 3D position.
canvasWidth The width of the Canvas, measured in pixels.
canvasHeight The height of the Canvas, measured in pixels.
Returns
A Vector3 object representing the screen coordinates, with x and y as pixel positions and z equal to zero
getDirectionFromScreen
Obtains the direction from the normalized coordinates
Syntax
getDirectionFromScreen(x, y, canvasWidth, canvasHeight)
Parameters
x The x-coordinate, measured in pixels.
y The y-coordinate, measured in pixels.
canvasWidth The width of the Canvas, measured in pixels.
canvasHeight The height of the Canvas, measured in pixels.
Returns
A Vector3 object representing the direction
CameraEvent
Describes the format of the object that is passed as an argument to the onEvent method of the
CameraEventHandler object.
Properties
Property Type Access Description
binding string read-only The view plane calculation type, which can take
one of the following values:
● "min"
● "max"
● "horizontal"
● "vertical"
canvas Canvas read-only The Canvas in which the event took place.
currentTool string read-only The name of the current tool.
far number read-only The distance from the Camera to the far clipping
plane. A value of -1 for both near and far signifies
to use auto clipping plane calculations.
fov number read-only The size of the field of view for perspective Camera
objects, measured in radians.
isNewCanvas Boolean read-only Deprecated
Determines whether this is the first event for this
Canvas.
near number read-only The distance from the Camera to the near clipping
plane. A value of -1 for both near and far signifies
to use auto clipping plane calculations.
projectionType string read-only The type of projection, which can take one of the
following values:
● "perspective"
● "orthographic"
targetDistance Vector3 read-only The distance from the Camera to its target.
transform Matrix4x4 read-only The Camera object’s transformation matrix.
viewPlaneSize number read-only The size of the view plane, measured in scene units.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference CameraEventHandler 24
CameraEventHandler
Exposes a callback mechanism that allows a function to be evaluated when an camera event occurs. Event
handlers are registered with the Runtime addEventHandler method, page 71.
CameraEventHandler
Constructor
Syntax
new CameraEventHandler()
Returns
A CameraEventHandler object
onEvent
A method that is called when a view is selected from the list of views on the 3D toolbar or in the context
menu for an active 3D annotation.
syntax
onEvent(event)
Parameters
event A CameraEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Canvas 25
Canvas
Represents a rectangular region into which the Scene is rendered from the viewpoint of the attached
Camera.
Properties
Property Type Access Description
background Background read-only The Background object associated with the
Canvas.
getCamera
Obtains the Camera object attached to the Canvas.
Syntax
getCamera()
Returns
A Camera object.
setCamera
Sets the Camera object attached to the Canvas.
Syntax
setCamera(camera)
Parameters
camera The Camera object used to set the object’s value.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference ClippingPlane 26
ClippingPlane
An object representing a plane, within the Scene, that clips all geometry on one side of it. It is created by
invoking the createClippingPlane method of the Scene object, described on page 81.
remove
Removes the ClippingPlane object from the Scene.
Syntax
remove()
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Color 27
Color
An object that represents a RGB encoded color.
Properties
Property Type Description
b number The blue component, which may contain a value from 0.0 to 1.0.
g number The green component, which may contain a value from 0.0 to 1.0.
r number The red component, which may contain a value from 0.0 to 1.0.
Color
Constructor
Syntax
new Color()
Returns
A Color object, initialized to black
Color
Constructor
Syntax
new Color(r, g, b)
Parameters
r The red component, which may contain a value from 0.0 to 1.0.
g The green component, which may contain a value from 0.0 to 1.0.
b The blue component, which may contain a value from 0.0 to 1.0.
Returns
A Color object, initialized to the supplied RGB values
set
Sets the Color object’s value using an existing Color object
Syntax
set(color)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference set 28
Parameters
color The Color object used to set the object’s value.
Returns
undefined
set
Acrobat 7.0.7
Sets the Color object’s value using the given RGB components.
Syntax
set(r, g, b)
Parameters
r The red component, which may contain a value from 0.0 to 1.0.
g The green component, which may contain a value from 0.0 to 1.0.
b The blue component, which may contain a value from 0.0 to 1.0.
Returns
undefined
set3
Deprecated
Sets the Color object’s value using the given RGB components.
Syntax
set3(r, g, b)
Parameters
r The red component, which may contain a value from 0.0 to 1.0.
g The green component, which may contain a value from 0.0 to 1.0.
b The blue component, which may contain a value from 0.0 to 1.0.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Console 29
Console
This object can direct output to the Acrobat console for debugging purposes. The variable console is a
global reference to this object.
print
Prints a string to the console.
Syntax
print(string)
Parameters
string The text to be printed to the console.
Returns
undefined
println
Prints a string with an accompanying newline to the console.
Syntax
println(string)
Parameters
string The text to be printed to the console.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Dummy 30
Dummy
Deprecated
HitInfo
The object returned when a hit test occurs during a MouseEvent, page 50.
Properties
Property Type Access Description
distance number read-only The distance from the Camera to the HitInfo
object’s position.
material Material read-only Acrobat 8.1
The material of the node that was hit.
position Vector3 read-only The position of the point where the hit
occurred.
surfaceNormal Vector3 read-only Acrobat 8.1
World-space surface normal direction at hit
location.
target Node read-only The target of the hit test.
textureCoordinate Vector3 read-only Acrobat 8.1
The texture coordinate of the material that was
hit.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Host 32
Host
Acrobat 7.0.7
An object that provides access to the JavaScript engine context and to pertinent objects within it. The
variable host is a global reference to this object. It is a reference to the JavaScript Document object in
which the 3D annotation is contained.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Image 33
Image
An object that represents an image.
Properties
Property Type Access Description
height number read-only The image’s height, measured in pixels.
width number read-only The image’s width, measured in pixels.
Image
Constructor
Syntax
new Image(resource)
Parameters
resource An Image object used to create the new object.
Returns
An Image object
KeyEvent
An object that is passed as an argument to the onEvent method, page 24, of the KeyEventHandler
object.
Properties
Property Type Access Description
canvas Canvas read-only The Canvas in which the KeyEvent took place
canvasPixelHeight integer read-only The height, measured in pixels, of the Canvas
canvasPixelWidth integer read-only The width, measured in pixels, of the Canvas
characterCode integer read-only The value of the character pressed according to
Acrobat’s character mapping, as per this listing of
Acrobat character codes:
KeyEventHandler
An object that exposes a callback mechanism that allows a function to be evaluated when a key event
occurs. Event handlers are registered with the Runtime addEventHandler method, described on
page 71.
KeyEventHandler
Constructor
Syntax
new KeyEventHandler()
Returns
A KeyEventHandler object
onEvent
A method that is called when a key is pressed.
Syntax
onEvent(event)
Parameters
event A KeyEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Light 37
Light
A Node object that illuminates meshes in the Scene. There are different types of Light objects, each with
their own distinct behavior. Infinite Light objects behave much like sunlight in that they cast parallel
light in a given direction. Spot Light objects have a fixed cone angle that limits their beam to a conical
projection. Point Light objects act similarly to a light bulb, where the light comes from a specific location
in 3D space. Currently, none of the Light objects cast shadows. In addition to the methods and
properties below, it also contains the same methods and properties as a Node.
Properties
Property Type Access Description
attenuationA number The a coefficient for attenuationType "abc".
attenuationB number The b coefficient for attenuationType "abc".
attenuationC number The c coefficient for attenuationType "abc".
attenuationType string The style of attenuation for the Light object
being represented. Attenuation determines
how fast the light intensity decreases with
distance. The attenuation type of “abc” uses the
equation 1 / max( ( a + bd + cdd ), 1 ) to
determine the intensity where d is the distance
from the light. One of the following values may
be assigned:
● "abc"
● "none"
ATTENUATION_ABC string read-only Acrobat 7.0.7
A string constant for the attenuationType of
"abc".
ATTENUATION_NONE string read-only Acrobat 7.0.7
A string constant for the attenuationType of
"none".
brightness number Specifies the brightness of the emission from
the Light. A value of 1 represents a brightness
of 100%, though the property may be assigned
higher values.
color Color read-only Specifies the color of the light.
direction Vector3 read-only The direction toward which the light is pointing.
directionLocal Vector3 read-only Acrobat 7, but not documented until
Acrobat 8.1
The direction toward which the light is pointing
relative to its parent Node.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Light 38
Material
A SceneObject that controls the appearance of materials using the fixed function shader. In addition to
the properties below, it also contains the same methods and properties as a SceneObject, documented
on page 83.
Properties
Property Type Access Description
ambientColor Color read-only The ambient color.
ambientTexture Texture read-only The ambient texture.
bumpTexture Texture read-only A texture map whose value is used to describe
the roughness of the object.
diffuseColor Color read-only The matte color of an object.
diffuseTexture Texture read-only A texture map that is used for the matte color of
the object.
emissiveColor Color read-only The emissive color.
emissiveTexture Texture read-only The emissive texture.
opacity number The total opacity of the material.
opacityTexture Texture read-only A texture map whose brightness is used for the
level of opacity of the object. White signifies
completely opaque while black signifies
completely transparent.
phongExponent number The phong exponent.
reflectionStrength Number The reflection level, which may contain a value
from 0.0 to 1.0.
reflectionTexture Texture read-only The reflection texture.
specularColor Color read-only The specular color.
specularStrength number The specular strength, which is a measure of
how shiny the material is.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Matrix4x4 40
Matrix4x4
A four-by-four matrix commonly used for transformations.
Properties
Property Type Access Description
determinant number The determinant of the matrix.
inverse Matrix4x4 read-only The inverse of the matrix.
scaleComponent Vector3 read-only The scale component of the transformation.
translation Vector3 read-only The translation component of the
transformation.
transpose Matrix4x4 read-only The transpose of the matrix.
Matrix4x4
Constructor
Syntax
new Matrix4x4()
Returns
A Matrix4x4 object initialized to the identity matrix
Matrix4x4
Constructor
Syntax
new Matrix4x4(matrix)
Parameters
matrix A Matrix4x4 object used to initialize the new matrix.
Returns
A Matrix4x4 object initialized to the specified matrix
invertInPlace
Inverts the matrix
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference isEqual 41
Returns
undefined
isEqual
Determines whether the current matrix is equal to the specified matrix
Syntax
isEqual(matrix)
Parameters
matrix A Matrix4x4 object used for the comparison.
Returns
True if the matrices are equal, false otherwise.
multiply
Multiplies the current matrix by the specified matrix.
Syntax
multiply(matrix)
Parameters
matrix A Matrix4x4 object used for the multiplication.
Returns
A Matrix4x4 object
multiplyInPlace
Multiplies the current matrix by the specified matrix, and updates the current matrix with the resulting
value.
Syntax
multiplyInPlace(matrix)
Parameters
matrix A Matrix4x4 object used for the multiplication.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference rotateWithQuaternion 42
Returns
undefined
rotateWithQuaternion
Rotates the current matrix using the specified Quaternion
Syntax
rotateWithQuaternion(quaternion)
Parameters
quaternion A Quaternion object used for the rotation.
Returns
A Matrix4x4 object
rotateWithQuaternionInPlace
Rotates the current matrix using the specified quaternion, and updates the current matrix with the
resulting value.
Syntax
rotateWithQuaternionInPlace(quaternion)
Parameters
quaternion A Quaternion object used for the rotation.
Returns
undefined
rotateAboutLine
Rotates the current matrix about the specified line.
Syntax
rotateAboutLine(angle, start, end)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference rotateAboutLineInPlace 43
Parameters
angle The angle of rotation, in radians
start A point described by a Vector3 object used to specify the beginning of the line of
rotation (which is represented by start - end).
end A point described by a Vector3 object used to specify the end of the line of rotation
(which is represented by start - end).
Returns
A Matrix4x4 object
rotateAboutLineInPlace
Rotates the current matrix about the specified line, and updates the current matrix with the resulting
value.
Syntax
rotateAboutLineInPlace(angle, start, end)
Parameters
angle The angle of rotation, in radians
start A Vector3 object used to specify the line of rotation (which is represented by start -
end).
end A Vector3 object used to specify the line of rotation (which is represented by start -
end).
Returns
undefined
rotateAboutX
Rotates the current matrix about the x-axis.
Syntax
rotateAboutX(angle)
Parameters
angle The angle of rotation, in radians.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference rotateAboutXInPlace 44
Returns
A Matrix4x4 object
rotateAboutXInPlace
Rotates the current matrix about the x-axis, and updates the current matrix with the resulting value.
Syntax
rotateAboutXInPlace(angle)
Parameters
angle The angle of rotation, in radians.
Returns
undefined
rotateAboutVector
Rotates the current matrix about the specified vector.
Syntax
rotateAboutVector(angle, axis)
Parameters
angle The angle of rotation, in radians.
axis A Vector3 object about which the matrix is rotated.
Returns
A Matrix4x4 object
rotateAboutVectorInPlace
Rotates the current matrix about the specified vector, and updates the current matrix with the resulting
value.
Syntax
rotateAboutVectorInPlace(angle, axis)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference rotateAboutY 45
Parameters
angle The angle of rotation, in radians.
axis A Vector3 object about which the matrix is rotated.
Returns
undefined
rotateAboutY
Rotates the current matrix about the y-axis.
Syntax
rotateAboutY(angle)
Parameters
angle The angle of rotation, in radians.
Returns
A Matrix4x4 object
rotateAboutYInPlace
Rotates the current matrix about the y-axis, and updates the current matrix with the resulting value.
Syntax
rotateAboutYInPlace(angle)
Parameters
angle The angle of rotation, in radians.
Returns
undefined
rotateAboutZ
Rotates the current matrix about the z-axis.
Syntax
rotateAboutZ(angle)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference rotateAboutZInPlace 46
Parameters
angle The angle of rotation, in radians.
Returns
A Matrix4x4 object
rotateAboutZInPlace
Rotates the current matrix about the z-axis, and updates the current matrix with the resulting value.
Syntax
rotateAboutZInPlace(angle)
Parameters
angle The angle of rotation, in radians.
Returns
undefined
scale
Scales the current matrix using the specified scaling components.
Syntax
scale(x, y, z)
Parameters
x The scaling component in the x-direction.
y The scaling component in the y-direction.
z The scaling component in the z-direction.
Returns
A Matrix4x4 object
scaleInPlace
Scales the current matrix using the specified scaling components, and updates the current matrix with the
resulting value.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference set 47
Syntax
scaleInPlace(x, y, z)
Parameters
x The scaling component in the x-direction.
y The scaling component in the y-direction.
z The scaling component in the z-direction.
Returns
undefined
set
Sets the value of the current matrix using the specified matrix.
Syntax
set(matrix)
Parameters
matrix The matrix whose value is copied into the current matrix.
Returns
undefined
setIdentity
Sets the value of the current matrix to the identity matrix.
Syntax
setIdentity()
Returns
undefined
setView
Sets the current matrix according to the specified component vectors.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference transformDirection 48
Syntax
setView(position, direction, up)
Parameters
position A Vector3 object used to specify the position component.
direction A Vector3 object used to specify the direction component.
up A Vector3 object used to specify the upward component.
Returns
undefined
transformDirection
Transforms the specified vector by the current matrix.
Syntax
transformDirection(vector)
Parameters
vector The Vector3 object to be transformed.
Returns
A Vector3 object
transformPosition
Transforms the specified position by the current matrix.
Syntax
transformPosition(position)
Parameters
position A Vector3 object representing the position to be transformed.
Returns
A Vector3 object
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference translate 49
translate
Translates the current matrix by the components of the specified vector.
Syntax
translate(translation)
Parameters
translation The Vector3 object whose components are used to perform the matrix
translation.
Returns
A Matrix4x4 object
translateInPlace
Translates the current matrix by the components of the specified vector, and updates the current matrix
with the resulting value.
Syntax
translateInPlace(translation)
Parameters
translation The Vector3 object whose components are used to perform the matrix
translation.
Returns
undefined
transposeInPlace
Sets the value of the current matrix to its transpose.
Syntax
transposeInPlace()
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference MenuEvent 50
MenuEvent
An object that is passed as an argument to the onEvent method of the MenuEventHandler object.
Properties
Property Type Access Description
canvas Canvas read-only The Canvas in which the MenuEvent took
place.
currentTool string read-only The name of the current tool.
menuItemChecked Boolean read-only Determines whether the menu item was
selected.
menuItemName string read-only The name of the selected menu item.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference MenuEventHandler 51
MenuEventHandler
A MenuEventHandler object exposes a callback mechanism that allows a function to be evaluated when
an event occurs. Event handlers are registered with the Runtime addEventHandler method.
MenuEventHandler
Constructor
Syntax
new MenuEventHandler()
Returns
A MenuEventHandler object
onEvent
A method that is called when a custom menu item is selected on the context menu for an active 3D
annotation.
Syntax
onEvent(event)
Parameters
event A MenuEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Mesh 52
Mesh
A Node object that contains geometry. A Mesh object with no geometry will have children Node objects
that may be transformed as a group. In addition to the methods and properties below, it also contains the
same methods and properties as a Node, see page 57.
Properties
Property Type Description
material Material The Mesh object’s default Material.
renderMode string The Mesh object’s rendering style, which can be one of the following
values:
● "default"
● "bounding box"
● "transparent bounding box"
● "transparent bounding box outline"
● "vertices"
● "shaded vertices"
● "wireframe"
● "shaded wireframe"
● "solid"
● "transparent"
● "solid wireframe"
● "transparent wireframe"
● "illustration"
● "solid outline"
● "shaded illustration"
● "hidden wireframe"
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference MouseEvent 53
MouseEvent
An object that is passed as an argument to the onEvent method of the MouseEventHandler object,
page 55.
Properties
Property Type Access Description
canvas Canvas read- The Canvas in which the MouseEvent took
only place.
canvasPixelHeight integer read- The height, measured in pixels, of the Canvas
only in which the MouseEvent took place.
canvasPixelWidth integer read- The width, measured in pixels, of the Canvas in
only which the MouseEvent took place.
ctrlKeyDown Boolean read- Determines whether the Ctrl key (Windows) or
only Command key (Mac OS) was pressed.
currentTool string read- The name of the current tool.
only
hits Array read- A set of HitInfo objects ordered by distance
only from nearest to furthest.
isDoubleClick Boolean read-only Determines whether the a double-click event
occurred
isMouseDown Boolean read-only Determines whether the mouse button has
been pressed
isMouseHit Boolean read-only Determines whether the target is under the
mouse cursor.
isMouseMove Boolean read-only Determines whether the mouse position has
changed.
isMouseOut Boolean read-only Determines whether the mouse position has
moved off the target.
isMouseOver Boolean read-only Determines whether the mouse position has
moved onto the target.
isMouseUp Boolean read-only Determines whether the mouse button has
been released.
leftButtonDown Boolean read-only Determines whether the left mouse button has
been pressed.
mouseX integer read-only The x position of the mouse cursor in the
Canvas.
MouseEventHandler
An object that exposes a callback mechanism that allows a function to be evaluated when mouse event
occurs. The handler may be customized to filter out certain event types. Event handlers are registered with
the Runtime addEventHandler method, see page 71.
Properties
Property Type Access Description
onMouseDoubleClick Boolean When set to true the handler will be called
back when a mouse button is clicked twice on
the target object in rapid succession. If no
target is specified the handler will call back on
any double-click.
onMouseDown Boolean When set to true the handler will be called
back when a mouse button is initially pressed
while the cursor is over the target object. If no
target is specified the handler will call back on
any button press.
onMouseHit Boolean When set to true the handler will be called
back continuously when the cursor is over the
target object. In the case of onMouseHit it
doesn’t matter if the target object is behind
another object in the scene. The list of
resultant hit objects are provided in the
MouseEvent hits property.
MouseEventHandler
Constructor
Syntax
new MouseEventHandler()
Returns
A MouseEventHandler object
onEvent
A method that is called when a mouse event occurs.
Syntax
onEvent(event)
Parameters
event A MouseEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Node 57
Node
An object within the Scene hierarchy (a SceneObject) that has a 3D representation. The following
objects are considered Node objects:
● Bone
● Camera
● ClippingPlane
● Dummy
● Light
● Mesh
● Procedural
To obtain a Node object’s type, use the standard JavaScript constructor property. For example, the
following syntax would print the Node object’s type to the console:
[Link]([Link]);
In addition to the methods and properties below, it also contains the same methods and properties as a
SceneObject, see page 75.
Properties
Property Type Access Description
firstChild Node (if the first read-only The Node object’s first child.
child exists), None
otherwise
hitEnabled Boolean Determines whether the Node is included in
hit tests. The default value is true.
info String read-only Acrobat 7.0.7
Information associated with the Node.
metadataString String read-only Acrobat 8.1
A string containing Node-specific metadata.
nextSibling Node (if the next read-only The next sibling.
sibling exists),
None otherwise
parent Object read-only The Node object’s parent Node or Scene.
transform Matrix4x4 read-only The local to world transformation matrix for
the Node.
wireframeColor Color read-only The Color object used to determine the
wireframe appearance.
visible Boolean Determines whether the Node object should
be shown.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference computeBoundingBox 58
computeBoundingBox
Acrobat 7.0.7
Syntax
computeBoundingBox()
Returns
A BoundingBox object.
detachFromCurrentAnimation
Removes the ability of the Node object’s currently active Animation to transform the Node.
Syntax
detachFromCurrentAnimation()
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Procedural 59
Procedural
Deprecated
A Node object used to represent procedurally created geometry such as constructive solid geometry
(CSG) solids, procedural spheres, or NURB objects (a 3D curve or surface). A Procedural object contains
the same methods and properties as a Node, see page 57.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Quaternion 60
Quaternion
Represents a rotation in 3D space, and allows for smooth interpolation (blending) between orientations of
subjects. A Quaternion is typically used for animating a Camera or Mesh over time, and can be
converted to and from angles of rotation about the axes.
Quaternion
Constructor that initializes the object with the identity matrix.
Syntax
new Quaternion()
Returns
A Quaternion object
Quaternion
Constructor that initializes the object with the specified rotation matrix
Syntax
new Quaternion(matrix)
Parameters
matrix A Matrix4x4 object representing the rotation matrix.
Returns
A Quaternion object
Quaternion
Constructor that initializes the object with the specified Quaternion
Syntax
new Quaternion(quaternion)
Parameters
quaternion A Quaternion object used to initialize the new object.
Returns
A Quaternion object
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference interpolate 61
interpolate
Creates a Quaternion object interpolated from the current and specified Quaternion objects and a.
Syntax
interpolate(quaternion, a)
Parameters
quaternion A Quaternion object used to interpolate the new object.
a A number value, from 0.0 to 1.0, that specifies the degree (percentage) of
interpolation. A value of 0.5 represents an interpolation halfway between the
current and specified Quaternion objects.
Returns
A Quaternion object
interpolateInPlace
Creates a Quaternion object interpolated from the current and specified Quaternion objects and a,
and updates the current Quaternion object with the new value.
Syntax
interpolateInPlace(quaternion, a)
Parameters
quaternion A Quaternion object used to interpolate the new object.
a A number value, from 0.0 to 1.0, that specifies the degree (percentage) of
interpolation. A value of 0.5 represents an interpolation halfway between the
current and specified Quaternion objects.
Returns
A Quaternion object
normalize
Normalizes the Quaternion object
Syntax
normalize()
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference RenderEvent 62
RenderEvent
An object that is passed as an argument to the RenderEventHandler object’s onEvent method.
Properties
Property Type Access Description
canvas Canvas read-only The Canvas that is the target of the
RenderEvent.
RenderEventHandler
An object that exposes a callback mechanism that allows a function to be evaluated when an event
occurs. Event handlers are registered with the Runtime addEventHandler method, page 71. It issues a
callback just before each Canvas is rendered.
RenderEventHandler
Constructor
Syntax
new RenderEventHandler()
Returns
A RenderEventHandler object
onEvent
A method that is called immediately before the Canvas is rendered.
Syntax
onEvent(event)
Parameters
event A RenderEvent object representing the event
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference RenderOptions 64
RenderOptions
An object that describes the style with which to render Node objects in the Scene.
Properties
Property Type Access Description
boundingBoxColor Color read-only A Color object to be
applied to the bounding
box.
clippingPlaneColor Color read-only A Color object to be
applied to the clipping
plane.
clippingPlaneIntersectionColor Color read-only A Color object to be
applied to the clipping
plane intersection.
defaultAmbientColor Color read-only A Color object to be
applied to the default
ambient Material.
defaultDiffuseColor Color read-only A Color object to be
applied to the default
diffuse Material.
defaultEmissiveColor Color read-only A Color object to be
applied to the default
emissive Material.
defaultSpecularColor Color read-only A Color object to be
applied to the default
specular Material.
illustrationRenderModeFaceColor Color read-only Acrobat 7.0.7
The color of the faces
when the render mode is
Illustration.
illustrationRenderModeLineColor Color read-only A Color object to be
applied to the
illustration lines.
pointsRenderModeColor Color read-only A Color object to be
applied to the vertices in
point render mode.
shadedIllustrationRenderModeLineColor Color read-only A Color object to be
applied to the shaded
illustration lines.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference RenderOptions 65
Resource
An object that creates an abstraction for loading behavior in files and streams.
Properties
Property Type Access Description
type string read-only The type of Resource object, which can be one
of the following values:
● "image"
● "model"
● "unknown"
TYPE_IMAGE string read-only Acrobat 7.0.7
A string constant for the Resource type of
"image".
TYPE_MODEL string read-only Acrobat 7.0.7
A string constant for the Resource type of
"model".
TYPE_UNKNOWN string read-only Acrobat 7.0.7
A string constant for the Resource type of
"unknown".
Resource
Constructor
Syntax
new Resource(pathname)
Parameters
pathname A string representing the path of the file or stream. Can only load embedded
resources from within the PDF file. The pathname string must start with pdf://
Returns
A Resource object.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Runtime 67
Runtime
An object that represents the runtime instance of the player. Each Runtime object can have its own
unique script engine and set of annotations. The variable runtime is a global reference to this object.
Properties
Property Type Access Description
addCustomMenuItem
Creates a custom menu item in the 3D annotation context menu.
Syntax
addCustomMenuItem(name, label, type, checkedState)
Parameters
name A string identifying the menu item.
label A string appearing on the menu item.
type A string indicating whether it is a checked menu item. A checked menu item has a
check mark toggle next to it. Its possible values are:
● "default"
● "checked"
checkedState A Boolean value indicating the state of a checked menu item.
Returns
undefined
addCustomToolButton
Creates a custom tool button in the 3D toolbar.
Syntax
addCustomToolButton(name, label, type)
Parameters
name A string identifying the tool button.
label A string appearing on the tool button.
type A string indicating whether it is a tool button or a push button. Its possible values are:
● "tool button"
● "push button"
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference addEventHandler 71
addEventHandler
Registers the provided event handler.
Syntax
addEventHandler(eventHandler)
Parameters
eventHandler The event handler object to be registered.
Returns
undefined
disableTool
Disables the tool with the specified ID.
Syntax
disableTool(toolName)
Parameters
toolName A string identifying the tool.
Returns
undefined
enableTool
Enables the tool with the specified ID.
Syntax
enableTool(toolName)
Parameters
toolName A string identifying the tool.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference getEventHandler 72
getEventHandler
Obtains the event handler corresponding to the specified index.
Syntax
getEventHandler(index)
Parameters
index An integer identifying the event handler.
Returns
An event handler object
getRendererName
Obtains the name of the current renderer.
Syntax
getRendererName()
Returns
A string containing the current renderer’s name
refresh
Version 7.0.1
Marks the render area dirty so that it will be redrawn. This is useful when something has changed in the
scene but the annotation is in a “Loaded” and not “Live” state.
Syntax
refresh()
Returns
undefined
removeEventHandler
Unregisters the specified event handler.
Syntax
removeEventHandler(handler)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference removeCustomMenuItem 73
Parameters
handler An event handler object representing the event handler.
Returns
undefined
removeCustomMenuItem
Removes the custom menu item with the specified ID.
Syntax
removeCustomMenuItem(menuName)
Parameters
menuName A string identifying the custom menu item.
Returns
undefined
removeCustomToolButton
Removes the custom tool button with the specified ID.
Syntax
removeCustomToolButton(toolName)
Parameters
toolName A string identifying the custom tool button.
Returns
undefined
setCurrentTool
Sets the current tool to the one with the specified ID.
Syntax
setCurrentTool(toolName)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference setCurrentTool 74
Parameters
toolName A string identifying the tool
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Scene 75
Scene
An object that represents the hierarchy of the 3D related content, including Animation, Light,
Material, and Mesh objects. The variable scene is a global reference to this object.
Related objects are Animation on page 15, Light on page 37, Material on page 39 and Mesh on
page 52.
Properties
Property Type Access Description
ambientIlluminationColor Color read-only Modulates the ambient
Color of all materials.
activateAnimation
Sets the given Animation to be active on its Node objects.
Syntax
activateAnimation(animation)
Parameters
animation The Animation object to be activated.
Returns
undefined
addModel
Adds a model Resource to the top level of the Scene.
Syntax
addModel(modelRes)
Parameters
modelRes The Resource object to be added.
Returns
A Node object representing the top-level Mesh of the loaded model
createClippingPlane
Creates a new clipping plane
Syntax
createClippingPlane()
Returns
A ClippingPlane object
createLight
Creates a new Light and attaches it to the Scene
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference createSquareMesh 82
Syntax
createLight()
Returns
A Light object
createSquareMesh
Creates a Mesh that is a unit square. The default UV parameterization fits once in U and V.
Syntax
createSquareMesh(sizeX, sizeY, name)
Parameters
sizeX Model units in the x-direction used to size the Mesh.
sizeY Model units in the y-direction used to size the Mesh.
name (Optional) The name that will be assigned to the Mesh.
Returns
A Mesh object
computeBoundingBox
Computes the BoundingBox of the Scene
Syntax
computeBoundingBox()
Returns
A BoundingBox object
update
Applies all changes to the Scene
Syntax
update()
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference SceneObject 83
SceneObject
The base type for objects within the Scene, including Animation, Material, and Node objects.
Related objects are Scene on page 75, Animation on page 15, Light on page 37, Material on
page 39 and Mesh on page 52.
Properties
Property Type Description
name string The SceneObject object’s name.
objectGUID string Deprecated
A value that uniquely identifies the SceneObject in custom data.
This property has a default value.
objectID integer An unsigned 32-bit value that uniquely identifies the
SceneObject. This property can be assigned, but does not have a
default value (it always returns 0).
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference SceneObjectList 84
SceneObjectList
A structure that contains references to several SceneObject objects.
Properties
Property Type Access Description
count integer read-only The number of elements in the SceneObjectList.
getByGUID
Deprecated
Syntax
getByGUID(guid)
Parameters
guid A string representing the GUID for the specified element.
Returns
A SceneObject object
getByID
Obtains the specified SceneObject object from the list
Syntax
getByID(id)
Parameters
id An integer representing the object identifier for the specified SceneObject object.
Returns
A SceneObject object
getByIndex
Obtains the specified SceneObject object from the list
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference getByName 85
Syntax
getByIndex(index)
Parameters
index An integer representing the index of the specified SceneObject object.
Returns
A SceneObject object
getByName
Obtains the specified SceneObject object from the list
Syntax
getByName(name)
Parameters
name A string representing the name of the specified SceneObject object.
Returns
A SceneObject object
removeAll
Removes all the SceneObject objects from the list
Syntax
removeAll()
Returns
undefined
removeByIndex
Removes the specified SceneObject object from the list
Syntax
removeByIndex(index)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference removeItem 86
Parameters
index An index to the specified element.
Returns
undefined
removeItem
Removes a SceneObject object from the list
Syntax
removeItem(scene_object)
Parameters
scene_object A scene object.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference ScrollWheelEvent 87
ScrollWheelEvent
(Acrobat 8.1) An object that is passed as an argument to the onEvent method of the
ScrollWheelHandler object, page 88. A ScrollWheelEvent object is created when the mouse scroll
wheel is activated over an active 3D Canvas object.
Properties
Property Type Access Description
canvas Canvas read-only The Canvas in which the ScrollWheelEvent
took place.
canvasPixelHeight integer read-only The height, measured in pixels, of the Canvas
in which the ScrollWheelEvent took place.
canvasPixelWidth integer read-only The width, measured in pixels, of the Canvas in
which the ScrollWheelEvent took place.
ctrlKeyDown Boolean read-only Determines whether the Ctrl key (Windows) or
Command key (Mac OS) was pressed.
currentTool string read-only The name of the current tool.
deltaY Number read-only The amount the scroll-wheel has been moved in
the Y direction.
shiftKeyDown Boolean read-only Determines whether the Shift key has been
pressed.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference ScrollWheelEventHandler 88
ScrollWheelEventHandler
(Acrobat 8.1) An object that exposes a callback mechanism that allows a function to be evaluated when an
event occurs. Event handlers are registered with the Runtime method addEventHandler on page 71.
ScrollWheelEventHandler
Constructor
Syntax
new ScrollWheelEventHandler()
Returns
A ScrollWheelEventHandler object.
onEvent
A method that is called when the scroll wheel is used in an active 3D annotation.
Syntax
onEvent(event)
Parameters
event A ScrollWheelEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference SelectionEvent 89
SelectionEvent
(Acrobat 8.1) An object that is passed as an argument to the onEvent method of the
SelectionEventHandler object, page 90.
A SelectionEvent object is created when an object is selected from an active 3D Canvas object or
from a model tree. If the selection is made from a Canvas object, a MouseEvent is also created.
Properties
Property Type Access Description
node Node read-only The Node that is the target of the selection
change.
selected Boolean read-only The selected state of the target Node.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference SelectionEventHandler 90
SelectionEventHandler
(Acrobat 8.1) An object that exposes a callback mechanism that allows a function to be evaluated when an
event occurs. Event handlers are registered with the Runtime addEventHandler method.
SelectionEventHandler
Constructor
Syntax
new SelectionEventHandler()
Returns
A SelectionEventHandler object.
onEvent
A method that is called when the selection state changes in an active 3D annotation.
Syntax
onEvent(event)
Parameters
event A ScrollWheelEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Texture 91
Texture
A Texture object represents the mapping of a texture. All Texture properties have read-write
permissions.
Properties
Property Type Description
amount number The degree to which the Texture is applied, which can be
a value from 0.0 to 1.0.
modulate Boolean Determines whether to set the blend mode of the Texture
with its corresponding color.
getImage
Deprecated
Syntax
getImage()
Returns
The Image currently being used.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference setImage 92
setImage
Deprecated
Syntax
setImage(image)
Parameters
image The Image to be used.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference TimeEvent 93
TimeEvent
An object that is passed as an argument to the TimeEventHandler object’s onEvent method.
Properties
Property Type Access Description
deltaTime number read-only The difference between the current time and the last time.
time number read-only The current time.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference TimeEventHandler 94
TimeEventHandler
An object that exposes a callback mechanism that allows a function to be evaluated when an event
occurs. Event handlers are registered with the Runtime addEventHandler method.
TimeEventHandler
Constructor
Syntax
new TimeEventHandler()
Returns
A TimeEventHandler object.
onEvent
A method that is called when simulation time is incremented in an active 3D annotation.
Syntax
onEvent(event)
Parameters
event A TimeEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference ToolEvent 95
ToolEvent
An object that is passed as an argument to the onEvent method of the ToolEventHandler object, see
page 96.
Properties
Property Type Access Description
canvas Canvas read-only The Canvas that is the target of the
ToolEvent.
ToolEventHandler
An object that exposes a callback mechanism that allows a function to be evaluated when an event
occurs. Event handlers are registered with the Runtime addEventHandler method, page 71.
ToolEventHandler
Constructor
Syntax
new ToolEventHandler()
Returns
A ToolEventHandler object
onEvent
A method that is called when a tool button is pressed on the 3D toolbar.
Syntax
onEvent(event)
Parameters
event A ToolEvent object representing the event.
Returns
undefined
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference Vector3 97
Vector3
An object comprised of three values that represent a point in space or a direction and magnitude.
Properties
Property Type Access Description
x number The x-component of the Vector3 object.
y number The y-component of the Vector3 object.
z number The z-component of the Vector3 object.
length number read-only The length of the Vector3 object.
Vector3
Constructor that initializes the new object to (0.0, 0.0, 0.0).
Syntax
new Vector3()
Returns
A Vector3 object
Vector3
Constructor that initializes the new object to the specified components
Syntax
new Vector3(x, y, z)
Parameters
x The x-component used to initialize the new object.
y The y-component used to initialize the new object.
z The z-component used to initialize the new object.
Returns
A Vector3 object
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference add 98
add
Adds the specified Vector3 to the current one.
Syntax
add(offset)
Parameters
offset The Vector3 object to be added to the current one.
Returns
A Vector3 object
addInPlace
Adds the specified Vector3 to the current one, and updates the current Vector3 with the resulting
value.
Syntax
addInPlace(offset)
Parameters
offset The Vector3 object to be added to the current one
Returns
undefined
addScaled
Adds the specified Vector3 with the scaled offset to the current one.
Syntax
addScaled(offset, scale)
Parameters
offset The Vector3 object to be added to the current one.
scale The scaling factor for the offset.
Returns
A Vector3 object
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference addScaledInPlace 99
addScaledInPlace
Adds the specified Vector3 with the scaled offset to the current one, and updates the current Vector3
with the resulting value.
Syntax
addScaledInPlace(offset, scale)
Parameters
offset The Vector3 object to be added to the current one.
scale The scaling factor for the offset.
Returns
undefined
blend
Blends the current and specified Vector3 by the specified degree.
Syntax
blend(vec, blendFactor)
Parameters
vec The Vector3 object to be blended with the current one.
blendFactor The degree of blending to be applied, which may be a value from 0.0 to 1.0.
Returns
A Vector3 object.
blendInPlace
Blends the current and specified Vector3 by the specified degree, and updates the current Vector3
with the resulting value.
Syntax
blendInPlace(vec, blendFactor)
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference cross 100
Parameters
vec The Vector3 object to be blended with the current one
blendFactor The degree of blending to be applied, which may be a value from 0.0 to 1.0
Returns
undefined
cross
Calculates the cross product between the specified Vector3 and the current one.
Syntax
cross(vec)
Parameters
vec The Vector3 object to be used in calculating the cross product.
Returns
A Vector3 object.
dot
Calculates the dot product between the specified Vector3 and the current one.
Syntax
dot(vec)
Parameters
vec The Vector3 object to be used in calculating the dot product
Returns
A number value representing the scalar dot product.
normalize
Normalizes the current Vector3.
Syntax
normalize()
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference scale 101
Returns
undefined
scale
Scales the current Vector3.
Syntax
scale(scale)
Parameters
scale A number value used to scale the current Vector3.
Returns
A Vector3 object
scaleInPlace
Scales the current Vector3, and updates the current Vector3 with the resulting value.
Syntax
scaleInPlace(scale)
Parameters
scale A number value used to scale the current Vector3.
Returns
undefined
set
Sets the current Vector3 to the value contained in the specified Vector3.
Syntax
set(vec)
Parameters
vec The Vector3 used to set the current Vector3.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference set 102
Returns
undefined
set
Acrobat 7.0.7
Sets the current Vector3 to the values contained in the specified components.
Syntax
set(x, y, z)
Parameters
x The x-component used to set the current Vector3.
y The y-component used to set the current Vector3.
z The z-component used to set the current Vector3.
Returns
undefined
set3
Deprecated
Sets the current Vector3 to the values contained in the specified components.
Syntax
set3(x, y, z)
Parameters
x The x-component used to set the current Vector3.
y The y-component used to set the current Vector3.
z The z-component used to set the current Vector3.
Returns
undefined
subtract
Subtracts the specified Vector3 from the current one.
Adobe Acrobat SDK JavaScript Objects for Acrobat 3D
JavaScript for Acrobat 3D Annotations API Reference subtractInPlace 103
Syntax
subtract(offset)
Parameters
offset The Vector3 object to be subtracted from the current one.
Returns
A Vector3 object
subtractInPlace
Subtracts the specified Vector3 from the current one, and updates the current Vector3 with the
resulting value.
Syntax
subtractInPlace(offset)
Parameters
offset The Vector3 object to be subtracted from the current one.
Returns
undefined
3 New Features and Changes
This chapter summarizes the new features and changes introduced in Acrobat 8.1 and earlier.
New objects
The following objects are new: ScrollWheelEvent, ScrollWheelEventHandler,
SelectionEvent, and ScrollWheelEventHandler.
The Light object has an additional property: directionLocal (Acrobat 7, but previously
undocumented).
The Scene object has the additional properties: node and selected.
[Link] (a property)
[Link] (a property)
[Link] (a method)
104
Adobe Acrobat SDK New Features and Changes
JavaScript for Acrobat 3D Annotations API Reference Additional properties in existing objects 105
3 BoundingBox object 19
3D JavaScript engine 9 center property 19
max property 19
min property 19
A boundingBoxColor property 64
Accessing the 3D JavaScript engine 9 brightness property 37
activateAnimation method 81 bumpTexture property 39
add method 98 BUTTON_TYPE_PUSH property 67
addCustomMenuItem method 70 BUTTON_TYPE_TOOL property 67
addCustomToolButton method 70
addEventHandler method 71
addInPlace method 98 C
addModel method 81 Camera object
addScaled method 98 binding property 20
addScaledInPlace method 99 BINDING_HORIZONTAL property 20
ambientColor property 39 BINDING_MAX property 20
ambientIlluminationColor property 75 BINDING_MIN property 20
ambientTexture property 39 BINDING_VERTICAL property 20
angle property 91 far property 20
Animation object 15 fov property 20
currentTime property 15 getDirectionFromScreen method 22
endTime property 15 getScreenFromPosition method 21
framesPerSecond property 15 near property 20
length property 15 position property 20
startTime property 15 positionLocal property 20
animations property 75 projectionType property 20
Annot3D.context3D property 9 roll property 21
ATTENUATION_ABC property 37 target property 21
ATTENUATION_NONE property 37 targetPosition property 21
attenuationA property 37 targetPositionLocal property 21
attenuationB property 37 TYPE_ORTHOGRAPHIC property 21
attenuationC property 37 TYPE_PERSPECTIVE property 21
attenuationType property 37 up property 21
upLocal property 21
viewPlaneSize property 21
B CameraEvent object 23
Background object 16 binding property 23
getColor method 16 canvas property 23
getImage method 16 currentTool property 23
image property 16 far property 23
setColor method 16 fov property 23
setImage method 17 isNewCanvas property 23
background property 25 near property 23
binding property 20, 23 projectionType property 23
BINDING_HORIZONTAL property 20 targetDistance property 23
BINDING_MAX property 20 transform property 23
BINDING_MIN property 20 viewPlaneSize property 23
BINDING_VERTICAL property 20 CameraEventHandler method 24
blend method 99 CameraEventHandler object 24
blendInPlace method 99 CameraEventHandler method 24
Bone object 18 cameras property 75
106
Adobe Acrobat SDK Index
JavaScript for Acrobat 3D Annotations API Reference 107
max property 19 N
MENU_ITEM_TYPE_CHECKED property 67 name property 83
MENU_ITEM_TYPE_DEFAULT property 67 near property 20, 23
MenuEvent object 50 nextSibling property 57
canvas property 50 Node object 57
currentTool property 50 computeBoundingBox method 58
menuItemChecked property 50 detachFromCurrentAnimation method 58
menuItemName property 50 directionLocal property 37
MenuEventHandler method 51 firstChild property 57
MenuEventHandler object hitEnabled property 57
MenuEventHandler method 51 info property 57
onEvent method 51 metadataString property 57
menuItemChecked property 50 nextSibling property 57
menuItemName property 50 parent property 57
Mesh object 52 transform property 57
material property 52 visible property 57
renderMode property 52 wireframeColor property 57
meshes property 77 node property 89
metadataString property 57 nodes property 77
min property 19 normalize method 61, 100
modulate property 91
MouseEvent object 53
canvas property 53, 87 O
canvasPixelHeight property 53, 87 objectGUID property 83
canvasPixelWidth property 53, 87 objectID property 83
ctrlKeyDown property 53, 87 onEvent method 24, 36, 51, 56, 63, 88, 90, 94, 96
currentTool property 53, 87 onMouseDoubleClick property 55
hits property 53 onMouseDown property 55
isDoubleClick property 53 onMouseHit property 55
isMouseDown property 53 onMouseMove property 55
isMouseHit property 53 onMouseOut property 55
isMouseMove property 53 onMouseOver property 55
isMouseOut property 53 onMouseUp property 55
isMouseOver property 53 opacityTexture property 39
isMouseUp property 53 outerConeAngle property 38
leftButtonDown property 53 outerRadius property 38
mouseX property 53 outlineAngle property 78
mouseY property 53 overrideNavTools property 67
rightButtonDown property 54 overridePanTool property 68
shiftKeyDown property 54, 87 overrideRotateTool property 68
MouseEventHandler method 56 overrideSelection property 68
MouseEventHandler object 55 overrideSpinTool property 68
MouseEventHandler method 56 overrideViewChange property 68
onEvent method 56 overrideWalkTool property 68
onMouseDoubleClick property 55 overrideWheelSpeed property 68
onMouseDown property 55 overrideZoomTool property 68
onMouseHit property 55
onMouseMove property 55 P
onMouseOut property 55 parent property 57
onMouseOver property 55 phongExponent property 39
onMouseUp property 55 pointsRenderModeColor property 64
reportAllTargets property 56 position property 20, 31, 38
target property 56 positionLocal property 20, 38
mouseX property 53 print method 29
mouseY property 53 println method 29
multiply method 41 Procedural object 59
multiplyInPlace method 41 projectionType property 20, 23
Adobe Acrobat SDK Index
JavaScript for Acrobat 3D Annotations API Reference 110
Image objects in the Adobe Acrobat SDK are defined primarily by the 'width' and 'height' properties, which give the pixel dimensions of the image. They are manipulated by creating new Image objects using constructors that define image resources. The manipulation support extends to integrating images within 3D annotations in Acrobat, although direct modification methods are limited to these properties .
In Adobe Acrobat SDK, Transform properties such as 'transformDirection' and 'transformPosition' are essential for modifying an object's positioning and orientation within the 3D environment. These properties allow for vector transformations that govern direction and spatial position changes, impacting how objects are visualized and interacted with in 3D scenes, thus enabling complex animations and precise placement in design workflows .
In the Adobe Acrobat SDK, interaction events are managed through various event handler objects like the MenuEventHandler, which capture and respond to user actions. The MenuEventHandler exposes a callback mechanism where a function can be evaluated when a menu-related event occurs. Using the addEventHandler method, it listens for the selection of custom menu items (MenuEvent) and triggers the onEvent method with relevant MenuEvent details such as 'menuItemName' and 'menuItemChecked' .
A Mesh object in Adobe Acrobat SDK has properties like 'material,' which defines the Mesh's default Material, and 'renderMode,' which dictates the Mesh's rendering style, such as 'wireframe' or 'solid.' These properties are significant as they define how the 3D object is visually represented, affecting visual attributes and rendering performance in 3D scenes .
The SelectionEvent in Adobe Acrobat SDK is unique as it is specifically triggered when an object is selected from a 3D Canvas or model tree, often in conjunction with MouseEvent creation. It includes properties such as 'node,' which refers to the target Node object, and 'selected,' marking it exclusively as a selection-triggered event. This specificity allows for tailored responses to selection actions, differentiating it from other events like MouseEvents or KeyEvents .
The ScrollWheelEventHandler is crucial for enhancing user interaction with 3D environments in Adobe Acrobat SDK. It provides a callback mechanism that processes events from the mouse scroll wheel when activated over a 3D Canvas object. Key properties like 'deltaY,' which indicates the scroll amount, and modifier keys such as 'ctrlKeyDown' influence how a 3D scene is navigated or zoomed, thus facilitating intuitive interaction and easy control for users .
The Adobe Acrobat SDK handles customization and integration of tools through its Runtime object methods, like 'addCustomMenuItem' and 'enableTool.' These methods enable the creation and management of user-defined menu items and tools within the Acrobat environment, facilitating custom workflows and interfaces. The ability to override default behaviors and tools like the 'selection' and 'rotate' tools enhances adaptability and user-centric design possibilities .
The Matrix4x4 method within Adobe Acrobat SDK plays a pivotal role in facilitating complex transformation operations such as rotation, scaling, and translation of 3D objects. Through methods like 'rotateAboutVector' and 'transformPosition,' Matrix4x4 enables precise spatial manipulation, crucial for rendering and animation processes. Its significance lies in providing a mathematical foundation for sophisticated 3D model interactions, directly impacting performance and accuracy in rendering tasks .
The RenderOptions object in Adobe Acrobat SDK defines various aspects of a 3D model's appearance, including properties such as 'wireframeRenderModeColor' and 'defaultDiffuseColor.' These properties determine visual styles like color and material display modes for rendering. By managing options like 'illustrationRenderModeLineColor,' users can tailor the rendering pipeline to achieve specific visual effects integral to detailed 3D modeling and visualization .
The KeyEventHandler in the Adobe Acrobat SDK provides a callback mechanism that triggers a function evaluation when a key event occurs. It interacts with the KeyEvent object by using the onEvent method, which is called each time a key is pressed. The KeyEvent object contains properties such as the characterCode, shiftKeyDown, and ctrlKeyDown, providing information about the pressed key and whether modifier keys like Shift and Ctrl are held down .