How to: Modify an Existing Text Markup Annotation
- 2 minutes to read
Important
You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use these examples in production code. Refer to the DevExpress Subscription page for pricing information.
This example shows how to change an existing markup annotation’s settings in a PDF document.
To retrieve all text markup annotations in a page, call the PdfDocumentProcessor.GetMarkupAnnotationData method.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-modify-an-existing-text-markup-annotation-t545429
Imports DevExpress.Pdf
Imports System
Imports System.Collections.Generic
Namespace ModifyExistingMarkupAnnotation
Friend Class Program
Shared Sub Main(ByVal args() As String)
' Create a PDF Document Processor.
Using processor As New PdfDocumentProcessor()
' Load a document.
processor.LoadDocument("..\..\Document.pdf")
' Get a list of annotations in the first document page.
Dim annotations As IList(Of PdfMarkupAnnotationData) = processor.GetMarkupAnnotationData(1)
If annotations.Count > 0 Then
' Change the properties of the first annotation.
annotations(0).Author = "Bill Smith"
annotations(0).Contents = "Important!"
annotations(0).Color = New PdfRGBColor(0.6, 0.7, 0.3)
annotations(0).Opacity = 0.2
' Save the result document.
processor.SaveDocument("..\..\Result.pdf")
Else
Console.WriteLine("The specified document page does not contain markup annotations!")
End If
End Using
End Sub
End Class
End Namespace
See Also