Multimedia

The current Java PdfContentEditorExamples class directly supports addMovieAnnotation(...).

Add a movie annotation

  1. Bind the source PDF to the PdfContentEditor facade.
  2. Call createMovie(...) with the annotation rectangle, movie file path, and page number.
  3. Save the updated PDF document.
public static void addMovieAnnotation(Path inputFile, Path movieFile, Path outputFile) {
    PdfContentEditor editor = new PdfContentEditor();
    try {
        editor.bindPdf(inputFile.toString());
        editor.createMovie(new Rectangle(80, 500, 220, 120), movieFile.toString(), 1);
        editor.save(outputFile.toString());
    } finally {
        editor.close();
    }
}