How To Create Movie Annotation in PDF Mosaic Library .NET

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

C# :

using PDFMosaic;
using System;
using System.IO;

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

      PDFMovie movie = new PDFMovie(Path.GetFullPath("..\\..\\test.avi"));
      PDFMovieAnnotation movieAnnotation = new PDFMovieAnnotation(movie, 40, 40, 100, 100);
      movieAnnotation.MovieActivation.ShowControls = true;
      page.Annotations.Add(movieAnnotation);

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

VB.NET :

Imports PDFMosaic
Imports System
Imports System.IO

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

    Dim movie As New PDFMovie(Path.GetFullPath("..\\..\\test.avi"))
    Dim movieAnnotation As New PDFMovieAnnotation(movie, 40, 40, 100, 100)
    movieAnnotation.MovieActivation.ShowControls = True
    page.Annotations.Add(movieAnnotation)

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