Pdf - PdfEmbeddedGoToAction

18 Nov 20268 minutes to read

Represents an action that navigates to a destination in an embedded PDF document.

// Create an embedded PDF document
let embeddedDocument: PdfDocument = new PdfDocument();
embeddedDocument.addPage();
let embeddedData: Uint8Array = embeddedDocument.save();
embeddedDocument.destroy();
// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Add the embedded PDF to the document
document.attachments.add(new PdfAttachment(embeddedData, 'embedded.pdf'));
// Create the embedded PDF destination
let destination: PdfRemoteDestination = new PdfRemoteDestination();
destination.pageNumber = 0;
destination.mode = PdfDestinationMode.fitToPage;
// Create the embedded PDF target
let target: PdfTargetDictionary = new PdfTargetDictionary(PdfTargetRelation.Child, 'embedded.pdf');
// Create the embedded GoTo action
let action: PdfEmbeddedGoToAction = new PdfEmbeddedGoToAction(destination, undefined, target);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(page, 'EmbeddedGoTo', { x: 20, y: 20, width: 120, height: 30 });
field.text = 'Open embedded PDF';
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Properties

Get destination PdfRemoteDestination

Gets the destination in the embedded PDF document.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Get the destination in the embedded PDF
let destination: PdfRemoteDestination = action.destination;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Set destination void

Sets the destination in the embedded PDF document.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Create a new destination in the embedded PDF
let destination: PdfRemoteDestination = new PdfRemoteDestination();
destination.pageNumber = 1;
destination.mode = PdfDestinationMode.fitToPage;
// Set the destination
action.destination = destination;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
value PdfRemoteDestination The destination in the embedded PDF document.

Get fileSpecification PdfFileSpecification

Gets the file specification associated with the action.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Get the file specification
let fileSpecification: PdfFileSpecification = action.fileSpecification;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Set fileSpecification void

Sets the file specification associated with the action.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Create a file specification
let fileSpecification: PdfFileSpecification = new PdfFileSpecification('embedded.pdf');
// Set the file specification
action.fileSpecification = fileSpecification;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
value PdfFileSpecification The file specification to associate with the action.

Get isNewWindow boolean

Gets a value indicating whether the embedded PDF opens in a new window.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Get the new-window setting
let isNewWindow: boolean = action.isNewWindow;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Set isNewWindow void

Sets whether the embedded PDF opens in a new window.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Open the embedded PDF in a new window
action.isNewWindow = true;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
value boolean true to open the embedded PDF in a new window; otherwise, false.

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 target PdfTargetDictionary

Gets the target dictionary used to locate the embedded PDF document.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Get the embedded target
let target: PdfTargetDictionary = action.target;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Set target void

Sets the target dictionary used to locate the embedded PDF document.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the embedded GoTo action
let action: PdfEmbeddedGoToAction = field.actions.mouseUp as PdfEmbeddedGoToAction;
// Create a child target for the embedded PDF
let target: PdfTargetDictionary = new PdfTargetDictionary(PdfTargetRelation.Child, 'embedded.pdf');
// Set the target dictionary
action.target = target;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
value PdfTargetDictionary The target dictionary to associate with the action.