PdfPageFacade.AddTextMarkupAnnotation(PdfOrientedRectangle, PdfTextMarkupAnnotationType) Method
In This Article
Creates a text markup annotation at the specified page area.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Core.dll
NuGet Package: DevExpress.Pdf.Core
#Declaration
public PdfTextMarkupAnnotationFacade AddTextMarkupAnnotation(
PdfOrientedRectangle textRectangle,
PdfTextMarkupAnnotationType style
)
#Parameters
Name | Type | Description |
---|---|---|
text |
Pdf |
A rectangle that specifies a page area where the annotation should be located. |
style | Pdf |
The text markup annotation type. |
#Returns
Type | Description |
---|---|
Pdf |
An object that contain text markup annotation properties. |
#Remarks
If a specified page area does not contain text, the AddTextMarkupAnnotation method returns null.
#Example
The code sample below strikes out specific text in the document:
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
// Load a document
processor.LoadDocument("..\\..\\Document.pdf");
// Access the first page properties
PdfDocumentFacade facade = processor.DocumentFacade;
PdfPageFacade page = facade.Pages[0];
// Find the target phrase in the document
string strikeOutText = "Xbox";
PdfTextSearchResults strikeSearchResults = processor.FindText(strikeOutText);
if (strikeSearchResults.Status == PdfTextSearchStatus.Found)
{
// Add text markup annotation to this phrase
PdfTextMarkupAnnotationFacade strikeOutAnnotation =
page.AddTextMarkupAnnotation(strikeSearchResults.Rectangles[0], PdfTextMarkupAnnotationType.StrikeOut);
// Specify annotation properties
strikeOutAnnotation.Author = "Bill Smith";
strikeOutAnnotation.Subject = "Important!";
strikeOutAnnotation.Contents = "Please, fact-check this reference";
strikeOutAnnotation.Color = new PdfRGBColor(0.10, 0.85, 1.00);
}
}
See Also