Back to Devexpress

PdfMarkupAnnotationDataExtensions Class

officefileapi-devexpress-dot-pdf-f7c4d16e.md

latest3.9 KB
Original Source

PdfMarkupAnnotationDataExtensions Class

Contains extension methods for the PdfMarkupAnnotationData class.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public static class PdfMarkupAnnotationDataExtensions
vb
Public Module PdfMarkupAnnotationDataExtensions

Remarks

Use PdfMarkupAnnotationDataExtensions methods to retrieve annotations of a specific type from the document page. Call the PdfDocumentProcessor.GetMarkupAnnotationData method to retrieve all annotations.

The code sample below changes the markup style for annotations made by a specific author and changes the icon for all text annotations:

csharp
using DevExpress.Pdf;
using System;
using System.Collections.Generic;
//...
private static void EditAnnotations(PdfDocumentProcessor processor)
{
    //Retrieve annotations made by the specified author:
    var textMarkups =
        processor.GetMarkupAnnotationData(1).
        Where(annotation => annotation.Author.Contains("Cardle Anita L"));
    foreach (PdfMarkupAnnotationData markup in textMarkups)
    {
        //Get all text markup annotations from the retrieved list:
        PdfTextMarkupAnnotationData pdfTextMarkup =
         markup.AsTextMarkupAnnotation();
        if (pdfTextMarkup != null)
            //Change the annotation's markup type:
            pdfTextMarkup.MarkupType = PdfTextMarkupAnnotationType.Squiggly;
    }

    var annotations = processor.GetMarkupAnnotationData(1);
    foreach (PdfMarkupAnnotationData annotation in annotations)
    {
        //Get all text annotations:
        PdfTextAnnotationData textAnnotation = annotation.AsTextAnnotation();
        if (textAnnotation != null)

            //Change the annotation icon:
            textAnnotation.IconName = PdfTextAnnotationIconName.Note;
    }
}
vb
Imports DevExpress.Pdf
Imports System
Imports System.Collections.Generic
'...

Private Shared Sub EditAnnotations(ByVal processor As PdfDocumentProcessor)
    'Retrieve annotations made by the specified author:
    Dim textMarkups = processor.GetMarkupAnnotationData(1).Where(Function(annotation) annotation.Author.Contains("Cardle Anita L"))
    For Each markup As PdfMarkupAnnotationData In textMarkups
        'Get all text markup annotations from the retrieved list:
        Dim pdfTextMarkup As PdfTextMarkupAnnotationData = markup.AsTextMarkupAnnotation()
        If pdfTextMarkup IsNot Nothing Then
            'Change the annotation's markup type:
            pdfTextMarkup.MarkupType = PdfTextMarkupAnnotationType.Squiggly
        End If
    Next markup

    Dim annotations = processor.GetMarkupAnnotationData(1)
    For Each annotation As PdfMarkupAnnotationData In annotations
        'Get all text annotations:
        Dim textAnnotation As PdfTextAnnotationData = annotation.AsTextAnnotation()
        If textAnnotation IsNot Nothing Then

            'Change the annotation icon:
            textAnnotation.IconName = PdfTextAnnotationIconName.Note
        End If
    Next annotation
End Sub

Inheritance

Object PdfMarkupAnnotationDataExtensions

See Also

PdfMarkupAnnotationDataExtensions Members

DevExpress.Pdf Namespace