Pdf - PdfSoundChannels
18 Nov 20261 minute to read
Public enum to define the channel layout of a PdfSound resource.
// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create and configure a sound resource
let sound: PdfSound = new PdfSound(soundData);
sound.bits = 16;
sound.channels = PdfSoundChannels.Stereo;
sound.encoding = PdfSoundEncoding.Signed;
sound.rate = 44100;
// Create a sound action
let action: PdfSoundAction = new PdfSoundAction(sound);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
page, 'PlaySound', { x: 20, y: 20, width: 120, height: 30 }
);
field.text = 'Play sound';
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();-
Mono- Specifies a single-channel sound resource. -
Stereo- Specifies a two-channel sound resource.