Pdf Component - PdfSoundIcon
18 Nov 20261 minute to read
Public enum to define the icon style for sound annotations in PDF documents.
// 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 sound annotation with speaker icon
let soundAnnotation: PdfSoundAnnotation = new PdfSoundAnnotation(page, {x: 50, y: 150, width: 20, height: 20});
// Set the icon to display as a speaker
soundAnnotation.icon = PdfSoundIcon.Speaker;
// Alternatively, create with microphone icon
let micAnnotation: PdfSoundAnnotation = new PdfSoundAnnotation(page, {x: 100, y: 150, width: 20, height: 20});
micAnnotation.icon = PdfSoundIcon.Microphone;
// Add annotations to the page
page.annotations.add(soundAnnotation);
page.annotations.add(micAnnotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();-
Microphone- Specifies the type ofmicrophone. -
Speaker- Specifies the type ofspeaker.