Back to Devexpress

PdfSoundAnnotationFacade Class

officefileapi-devexpress-dot-pdf-71ab2a08.md

latest4.5 KB
Original Source

PdfSoundAnnotationFacade Class

Contains members used to manage sound annotations without access to their inner structure.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public class PdfSoundAnnotationFacade :
    PdfMarkupAnnotationFacade
vb
Public Class PdfSoundAnnotationFacade
    Inherits PdfMarkupAnnotationFacade

Remarks

Access Sound Annotations

Note

This annotation type is deprecated in PDF 2.0. You cannot add sound annotations to the PDF file.

The PdfPageFacade.Annotations property returns all page annotation properties. You can filter text annotation properties, cast them to the PdfSoundAnnotationFacade class, and use class properties to modify annotation parameters.

Flatten Sound Annotations

Utilize one of the following methods to flatten a sound annotation:

MethodDescription
PdfDocumentFacade.FlattenAnnotations()Flattens document annotations.
PdfPageFacade.FlattenAnnotations()Flattens annotations of a specific page.
PdfAnnotationFacade.Flatten()Flattens a specific annotation.

The code sample below flattens all sound annotations on the page.

csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document
    processor.LoadDocument("..\\..\\Document.pdf");

    // Access page properties
    PdfDocumentFacade facade = processor.DocumentFacade;
    PdfPageFacade page = facade.Pages[0];

    // Flatten all sound annotations
    page.FlattenAnnotations(PdfAnnotationType.Sound);
}
vb
Using processor As New PdfDocumentProcessor()

  'Load a document:
  processor.LoadDocument("..\..\Document.pdf")

  ' Access page properties
  Dim facade As PdfDocumentFacade = processor.DocumentFacade
  Dim page As PdfPageFacade = facade.Pages(0)

  ' Flatten all sound annotations
  page.FlattenAnnotations(PdfAnnotationType.Sound)
End Using

Remove Sound Annotations

Call the PdfAnnotationFacade.Remove() method to remove an annotation. The code sample below removes all sound annotations on the first page.

csharp
using DevExpress.Pdf;
using System.Linq;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{

  // Load a document
  processor.LoadDocument("..\\..\\Document.pdf");

  // Access page properties
  PdfDocumentFacade facade = processor.DocumentFacade;
  PdfPageFacade page = facade.Pages[0];

  // Retrieve all sound annotations
  var soundAnnotations = page.Annotations.Where
    (annotation => annotation.Type == PdfAnnotationType.Sound).ToList();

  // Remove all sound annotations
  foreach (PdfSoundAnnotationFacade sound in soundAnnotations)
  {
      sound.Remove();
  }
}
vb
Imports DevExpress.Pdf
Imports System.Linq

Using processor As New PdfDocumentProcessor()
processor

  'Load a document:
  processor.LoadDocument("..\..\Document.pdf")

  ' Access page properties
  Dim facade As PdfDocumentFacade = processor.DocumentFacade
  Dim page As PdfPageFacade = facade.Pages(0)

  ' Retrieve all sound annotations
  Dim soundAnnotations = page.Annotations.Where
    (Function(annotation) annotation.Type = PdfAnnotationType.Sound).ToList()

  ' Remove all sound annotations
  For Each sound As PdfRubberStampAnnotationFacade In soundAnnotations
    sound.Remove()
  Next sound
End Using

s

Inheritance

Object PdfAnnotationFacade PdfMarkupAnnotationFacade PdfSoundAnnotationFacade

See Also

PdfSoundAnnotationFacade Members

DevExpress.Pdf Namespace