Pdf - PdfMovieAnnotation

18 Nov 202618 minutes to read

PdfMovieAnnotation class represents the movie annotation.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access first page
let page: PdfPage = document.getPage(0);
// Access the annotation at index 0
let annotation: PdfMovieAnnotation = page.annotations.at(0) as PdfMovieAnnotation;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Properties

Get actions PdfAnnotationActions

Gets the actions associated with the annotation events.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create a rectangle annotation
let annotation: PdfRectangleAnnotation = new PdfRectangleAnnotation(
    { x: 20, y: 20, width: 150, height: 60 }
);
// Get the annotation actions and assign an action
let actions: PdfAnnotationActions = annotation.actions;
actions.mouseEnter = new PdfJavaScriptAction('app.alert("Mouse entered");');
// Add the annotation to the page
page.annotations.add(annotation);
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Get activationEnabled boolean

Gets whether movie activation is enabled.

Set activationEnabled void

Sets whether movie activation is enabled.

Parameter Type Description
value boolean true to enable activation; otherwise, false.

Get aspect Size

Gets the movie aspect dimensions.

Set aspect void

Sets the movie aspect dimensions.

Parameter Type Description
value Size The aspect width and height. Must be positive when set.

Get author string

Gets the author of the annotation.

Set author void

Sets the author of the annotation.

Parameter Type Description
value string Author.

Get border PdfAnnotationBorder

Gets the border of the annotation.

Set border void

Sets the border of the annotation.

Parameter Type Description
value PdfAnnotationBorder Border.

Get bounds Rectangle

Gets the bounds of the annotation.

Set bounds void

Sets the bounds of the annotation.

Parameter Type Description
value Rectangle Bounds.

Get caption PdfAnnotationCaption

Gets the caption of the annotation.

Set caption void

Sets the caption of the annotation.

Parameter Type Description
value PdfAnnotationCaption Annottion caption.

Get color PdfColor

Gets the fore color of the annotation.

Set color void

Sets the fore color of the annotation.

Parameter Type Description
value PdfColor R, G, B color values in between 0 to 255.

Get comments PdfPopupAnnotationCollection

Gets the comments of the PDF annotation (Read only).

Get creationDate Date

Gets the creation date of the annotation.

Set creationDate void

Sets the creation date of the annotation.

Parameter Type Description
value Date Creation date.

Get data Uint8Array

Gets the embedded movie bytes.

Set data void

Sets the embedded movie bytes. The separately assigned file name and MIME type are preserved.

Parameter Type Description
value Uint8Array The movie bytes. Cannot be null, undefined, or empty.

Get duration PdfMovieTime

Gets the playback duration.

Set duration void

Sets the playback duration.

Parameter Type Description
value PdfMovieTime The duration value and optional time scale.

Get fileName string

Gets the movie file name.

Set fileName void

Sets the movie file name.

Parameter Type Description
value string The movie file name. Cannot be null, undefined, or empty.

Get flags PdfAnnotationFlag

Gets the flags of the annotation.

Set flags void

Sets the flags of the annotation.

Parameter Type Description
value PdfAnnotationFlag Flag value.

Get flatten boolean

Gets the boolean flag indicating whether the annotation have been flattened or not.

Set flatten void

Sets the boolean flag indicating whether the annotation have been flattened or not.

Parameter Type Description
value boolean Flatten.

Get flattenPopups boolean

Gets the boolean flag indicating whether annotations popup have been flattened or not.

Set flattenPopups void

Sets the boolean flag indicating whether the annotations popup have been flattened or not.

Parameter Type Description
value boolean Flatten Popup.

Get floatingWindowPosition Object

Gets the floating-window position.

Set floatingWindowPosition void

Sets the floating-window position.

Parameter Type Description
value Object The horizontal and vertical position from 0 to 1.

Get floatingWindowScale Object

Gets the floating-window scale.

Set floatingWindowScale void

Sets the floating-window scale.

Parameter Type Description
value Object The scale numerator and denominator. Must be positive integers when set.

Get innerColor PdfColor

Gets the inner color of the annotation.

Set innerColor void

Sets the inner color of the annotation.

Parameter Type Description
value PdfColor R, G, B color values in between 0 to 255.

Get layer PdfLayer

Gets the PdfLayer of the annotation.

Set layer void

Set the PdfLayer to the annotation.

Parameter Type Description
value PdfLayer PDF layer to the annotation.

Get mimeType string

Gets the movie MIME type.

Set mimeType void

Sets the movie MIME type.

Parameter Type Description
value string The movie MIME type (e.g. ‘video/mp4’). Cannot be null, undefined, or empty.

Get modifiedDate Date

Gets the modification date of the annotation.

Set modifiedDate void

Sets the modification date of the annotation.

Parameter Type Description
value Date Modified date.

Get name string

Gets the name of the annotation.

Set name void

Sets the name of the annotation.

Parameter Type Description
value string Name.

Get opacity number

Gets the opacity of the annotation.

Set opacity void

Sets the opacity of the annotation.

Parameter Type Description
value number Opacity in between 0 t0 1.

Get playMode PdfMoviePlayMode

Gets the playback mode of the movie.

Set playMode void

Sets the playback mode of the movie.

Parameter Type Description
value PdfMoviePlayMode The play mode (once, open, repeat, or palindrome).

Get rate number

Gets the playback rate of the movie.

Set rate void

Sets the playback rate of the movie.

Parameter Type Description
value number The playback rate. Must be finite and non-zero.

Get reviewHistory PdfPopupAnnotationCollection

Gets the review history of the PDF annotation (Read only).

Get rotate number

Gets the rotation angle of the annotation (Read only).

Get rotation number

Gets the clockwise movie rotation in degrees.

Set rotation void

Sets the clockwise movie rotation in degrees.

Parameter Type Description
value number The rotation angle. Must be an integer multiple of 90 degrees.

Get rotationAngle PdfRotationAngle

Gets the rotation of the annotation.

Set rotationAngle void

Sets the rotation of the annotation.

Parameter Type Description
value PdfRotationAngle Rotation angle.

Get showControls boolean

Gets whether playback controls are displayed.

Set showControls void

Sets whether playback controls are displayed.

Parameter Type Description
value boolean true to show controls; otherwise, false.

Get showPoster boolean

Gets whether a poster is displayed for the movie.

Set showPoster void

Sets whether a poster is displayed for the movie.

Parameter Type Description
value boolean true to display a poster; otherwise, false.

Get start PdfMovieTime

Gets the playback start time.

Set start void

Sets the playback start time.

Parameter Type Description
value PdfMovieTime The start time value and optional time scale.

Get subject string

Gets the subject of the annotation.

Set subject void

Sets the subject of the annotation.

Parameter Type Description
value string Subject.

Get synchronous boolean

Gets whether playback is synchronous.

Set synchronous void

Sets whether playback is synchronous.

Parameter Type Description
value boolean true for synchronous playback; otherwise, false.

Get text string

Gets the text of the annotation.

Set text void

Sets the text of the annotation.

Parameter Type Description
value string Text.

Get volume number

Gets the playback volume of the movie.

Set volume void

Sets the playback volume of the movie.

Parameter Type Description
value number The volume. Must be between -1 and 1.

Methods

createTemplate

Gets the annotation appearance as a PDF template.

Returns PdfTemplate

getValues

Gets the values associated with the specified key.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Gets the values associated with the key 'Author'.
let values: string[] = document.getPage(0).annotations.at(0).getValues('Author');
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
name string Key.

Returns string[]

setAppearance

Set the boolean flag to create a new appearance stream for annotations.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Set the boolean flag to create a new appearance stream for annotations.
document.getPage(0).annotations.at(0).setAppearance(true);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
value boolean Set appearance.

Returns void

setValues

Sets the values associated with the specified key.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access the annotation at index 0
let annotation: PdfAnnotation = document.getPage(0).annotations.at(0);
// Set Unknown state and model
annotation.setValues('State', 'StateModel');
annotation.setValues('StateModel', 'CustomState');
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
Parameter Type Description
name string Key.
value string Value associated with the key..

Returns void