Pdf - PdfScreenAnnotationTrigger

18 Nov 20261 minute to read

Defines the activation triggers available for screen 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 screen annotation
let annotation: PdfScreenAnnotation = new PdfScreenAnnotation(
    { x: 50, y: 50, width: 200, height: 150 }
);
// Set the activation trigger
annotation.trigger = PdfScreenAnnotationTrigger.MouseUp;
// Add the annotation to the page
page.annotations.add(annotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • MouseDown - Specifies activation on mouse-button down.
  • MouseEnter - Specifies activation when the pointer enters the annotation area.
  • MouseExit - Specifies activation when the pointer leaves the annotation area.
  • MouseUp - Specifies activation on mouse-button up.