Pdf - PdfMoviePlayMode

18 Nov 20261 minute to read

Defines the playback modes available for movie annotations.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access the first page
let page: PdfPage = document.getPage(0) as PdfPage;
// Create a movie annotation
let annotation: PdfMovieAnnotation = new PdfMovieAnnotation(
    { x: 50, y: 50, width: 200, height: 150 }
);
// Set the playback mode
annotation.playMode = PdfMoviePlayMode.Repeat;
// Add the annotation to the page
page.annotations.add(annotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • Once - Specifies single playback.
  • Open - Specifies playback when the movie is opened.
  • Palindrome - Specifies palindrome playback.
  • Repeat - Specifies repeated playback.