Pdf - PdfRichMediaDeactivationMode

18 Nov 20261 minute to read

Defines the deactivation modes available for rich media 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 rich media annotation
let annotation: PdfRichMediaAnnotation = new PdfRichMediaAnnotation(
    { x: 50, y: 50, width: 200, height: 150 }
);
// Set the deactivation mode
annotation.deactivationMode = PdfRichMediaDeactivationMode.PageInvisible;
// Add the annotation to the page
page.annotations.add(annotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • ExplicitDeactivation - Specifies explicit deactivation.
  • PageClose - Specifies deactivation when the page is closed.
  • PageInvisible - Specifies deactivation when the page becomes invisible.