Pdf - PdfRichMediaExecuteAction
18 Nov 20265 minutes to read
Represents an action that executes a command on an existing rich-media annotation.
// Load an existing PDF document containing a rich-media annotation
let document: PdfDocument = new PdfDocument(data, password);
let page: PdfPage = document.getPage(0);
// Get the existing rich-media annotation
let annotation: PdfRichMediaAnnotation = page.annotations.at(0) as PdfRichMediaAnnotation;
// Create a rich-media command
let command: PdfRichMediaCommand = new PdfRichMediaCommand('play');
// Create a rich-media execute action
let action: PdfRichMediaExecuteAction = new PdfRichMediaExecuteAction(annotation, command);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
page, 'ExecuteRichMedia', { x: 20, y: 20, width: 140, height: 30 }
);
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();Properties
Get annotation PdfRichMediaAnnotation
Gets the target rich-media annotation.
// Load an existing PDF document containing a rich-media execute action
let document: PdfDocument = new PdfDocument(data, password);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the rich-media execute action
let action: PdfRichMediaExecuteAction = field.actions.mouseUp as PdfRichMediaExecuteAction;
// Get the target rich-media annotation
let annotation: PdfRichMediaAnnotation = action.annotation;
// Save and destroy the document
document.save('output.pdf');
document.destroy();Set annotation void
Sets the target rich-media annotation.
// Load an existing PDF document containing a rich-media annotation
let document: PdfDocument = new PdfDocument(data, password);
let page: PdfPage = document.getPage(0);
// Get the existing rich-media annotation
let annotation: PdfRichMediaAnnotation = page.annotations.at(0) as PdfRichMediaAnnotation;
// Get the rich-media execute action
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
let action: PdfRichMediaExecuteAction = field.actions.mouseUp as PdfRichMediaExecuteAction;
// Set the target rich-media annotation
action.annotation = annotation;
// Save and destroy the document
document.save('output.pdf');
document.destroy();| Parameter | Type | Description |
|---|---|---|
| value | PdfRichMediaAnnotation |
The target rich-media annotation. |
Get command PdfRichMediaCommand
Gets the command executed on the target rich-media annotation.
// Load an existing PDF document containing a rich-media execute action
let document: PdfDocument = new PdfDocument(data, password);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the rich-media execute action
let action: PdfRichMediaExecuteAction = field.actions.mouseUp as PdfRichMediaExecuteAction;
// Get the rich-media command
let command: PdfRichMediaCommand = action.command;
// Save and destroy the document
document.save('output.pdf');
document.destroy();Set command void
Sets the command executed on the target rich-media annotation.
// Load an existing PDF document containing a rich-media execute action
let document: PdfDocument = new PdfDocument(data, password);
// Get the button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the rich-media execute action
let action: PdfRichMediaExecuteAction = field.actions.mouseUp as PdfRichMediaExecuteAction;
// Create and set a rich-media command
let command: PdfRichMediaCommand = new PdfRichMediaCommand('pause');
action.command = command;
// Save and destroy the document
document.save('output.pdf');
document.destroy();| Parameter | Type | Description |
|---|---|---|
| value | PdfRichMediaCommand |
The command to execute on the target rich-media 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. |