Pdf - PdfGoTo3DViewAction

18 Nov 20264 minutes to read

Represents an action that navigates to a view of a 3D annotation.

// Load an existing PDF document containing a 3D annotation
let document: PdfDocument = new PdfDocument(data, password);
let page: PdfPage = document.getPage(0);
// Get the existing 3D annotation
let annotation: Pdf3DAnnotation = page.annotations.at(0) as Pdf3DAnnotation;
// Create a 3D-view action
let action: PdfGoTo3DViewAction = new PdfGoTo3DViewAction(annotation, 'DefaultView');
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
    page, 'GoTo3DView', { x: 20, y: 20, width: 120, height: 30 }
);
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Properties

Get annotation Pdf3DAnnotation

Gets the target 3D annotation.

// Load an existing PDF document containing a 3D-view action
let document: PdfDocument = new PdfDocument(data, password);
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the 3D-view action
let action: PdfGoTo3DViewAction = field.actions.mouseUp as PdfGoTo3DViewAction;
// Get the target 3D annotation
let annotation: Pdf3DAnnotation = action.annotation;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set annotation void

Sets the target 3D annotation.

// Load an existing PDF document containing a 3D annotation
let document: PdfDocument = new PdfDocument(data, password);
let page: PdfPage = document.getPage(0);
// Get the existing 3D annotation
let annotation: Pdf3DAnnotation = page.annotations.at(0) as Pdf3DAnnotation;
// Get the button field and its 3D-view action
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
let action: PdfGoTo3DViewAction = field.actions.mouseUp as PdfGoTo3DViewAction;
// Set the target 3D annotation
action.annotation = annotation;
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value Pdf3DAnnotation The target 3D annotation.

Get next PdfAction

Get the next action to be performed after the action represented by this instance.

Set next void

Set the next action to be performed after the action represented by this instance.

Parameter Type Description
value PdfAction The next action to be executed.

Get view string | number

Gets the name or index of the target 3D view.

// Load an existing PDF document containing a 3D-view action
let document: PdfDocument = new PdfDocument(data, password);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the 3D-view action
let action: PdfGoTo3DViewAction = field.actions.mouseUp as PdfGoTo3DViewAction;
// Get the name or index of the target 3D view
let view: string | number = action.view;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set view void

Sets the name or index of the target 3D view.

// Load an existing PDF document containing a 3D-view action
let document: PdfDocument = new PdfDocument(data, password);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the 3D-view action
let action: PdfGoTo3DViewAction = field.actions.mouseUp as PdfGoTo3DViewAction;
// Set the target 3D view
action.view = 'DefaultView';
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value string | number The name or zero-based index of the target 3D view.