Pdf - PdfGoToDocumentPartAction
18 Nov 20263 minutes to read
Represents an action that navigates to a document-part destination in a PDF document.
// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let firstPage: PdfPage = document.addPage();
let secondPage: PdfPage = document.addPage();
// Create a destination on the second page
let destination: PdfDestination = new PdfDestination(secondPage);
destination.mode = PdfDestinationMode.fitToPage;
// Create a document-part navigation action
let action: PdfGoToDocumentPartAction = new PdfGoToDocumentPartAction(destination);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
firstPage, 'GoToDocumentPart', { x: 20, y: 20, width: 120, height: 30 }
);
field.text = 'Open document part';
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();Properties
Get destination PdfDestination
Gets the destination associated with the document part.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the document-part navigation action
let action: PdfGoToDocumentPartAction = field.actions.mouseUp as PdfGoToDocumentPartAction;
// Get the document-part destination
let destination: PdfDestination = action.destination;
// Save and destroy the document
document.save('output.pdf');
document.destroy();Set destination void
Sets the destination associated with the document part.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
let page: PdfPage = document.getPage(1);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the document-part navigation action
let action: PdfGoToDocumentPartAction = field.actions.mouseUp as PdfGoToDocumentPartAction;
// Create and set the document-part destination
let destination: PdfDestination = new PdfDestination(page);
destination.mode = PdfDestinationMode.fitToPage;
action.destination = destination;
// Save and destroy the document
document.save('output.pdf');
document.destroy();| Parameter | Type | Description |
|---|---|---|
| value | PdfDestination |
The destination to associate with the document part. |
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. |