How To Create Sound Annotation in PDF Mosaic Library .NET

This sample shows how to add sound annotations to your PDF document.

C# :

using PDFMosaic;
using System;

namespace SoundAnnotation
{
  class SoundAnnotation
  {
    static void Main()
    {
      PDFDocument document = new PDFDocument();
      PDFPage page = new PDFPage(PDFPaperFormat.A4);

      PDFSound sound = new PDFSound("..\\..\\911.wav");
      PDFSoundAnnotation soundAnnotation = new PDFSoundAnnotation(sound, 20, 40, 15, 15);
      page.Annotations.Add(soundAnnotation);

      document.Pages.Add(page);
      document.Save("SoundAnnotation.pdf", true);
    }
  }
}

VB.NET :

Imports PDFMosaic
Imports System

Module SoundAnnotation
  Sub Main()
    Dim document As New PDFDocument()
    Dim page As New PDFPage(PDFPaperFormat.A4)

    Dim sound As New PDFSound("..\\..\\911.wav")
    Dim soundAnnotation As New PDFSoundAnnotation(sound, 20, 40, 15, 15)
    page.Annotations.Add(soundAnnotation)

    document.Pages.Add(page)
    document.Save("SoundAnnotation.pdf", True)
  End Sub
End Module