Table of Contents

Class PdfFreeTextAnnotation

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents the PDF text annotation.

public class PdfFreeTextAnnotation : PdfAnnotation, INotifyPropertyChanged
Inheritance
PdfFreeTextAnnotation
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Remarks

This PdfFreeTextAnnotation class is used to add the text directly on the page. Please refer the UG docuemntation link for more details.

Constructors

PdfFreeTextAnnotation(RectangleF)

Initializes a new instance of the PdfFreeTextAnnotation class with specified bounds.

public PdfFreeTextAnnotation(RectangleF rectangle)

Parameters

rectangle RectangleF

The bounds of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

Properties

AnnotationIntent

Gets or sets the intent of the text annotation

public PdfAnnotationIntent AnnotationIntent { get; set; }

Property Value

PdfAnnotationIntent

The PdfAnnotationIntent object sets the annotation intent.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

BorderColor

Gets or sets the border color of the text annotation.

public PdfColor BorderColor { get; set; }

Property Value

PdfColor

The PdfColor which draws the border of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

CalloutLines

Gets or sets the points array to be called out the lines.

public PointF[] CalloutLines { get; set; }

Property Value

PointF[]

The array of points to call out lines.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

Comments

Gets the annotation comments

public PdfPopupAnnotationCollection Comments { get; }

Property Value

PdfPopupAnnotationCollection

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation freeTextAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation";
freeTextAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//set Comments state
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
freeTextAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = freeTextAnnotation.Comments;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim textAnnotationBounds As RectangleF = New RectangleF(10, 40, 100, 30)
Dim freeTextAnnotation As PdfFreeTextAnnotation = New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation"
freeTextAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
freeTextAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = freeTextAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
See Also

ComplexScript

Gets or sets the complex script to add different languages texts in free text annotation.

public bool ComplexScript { get; set; }

Property Value

bool

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation freeTextAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation";
freeTextAnnotation.ComplexScript = true;
freeTextAnnotation.Font = new PdfTrueTypeFont(new Font("Nirmala UI", 14), true);
//Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//set Comments state
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "पत्र‍ांक दिनांक";
freeTextAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = freeTextAnnotation.Comments;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim textAnnotationBounds As RectangleF = New RectangleF(10, 40, 100, 30)
Dim freeTextAnnotation As PdfFreeTextAnnotation = New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation"
freeTextAnnotation.Font = New PdfTrueTypeFont(New Font("Nirmala UI", 14), True)
freeTextAnnotation.ComplexScript = True
'Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "पत्र‍ांक दिनांक"
freeTextAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = freeTextAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
See Also

Font

Gets or sets the font of the text annotation

public PdfFont Font { get; set; }

Property Value

PdfFont

The PdfFont object which defines the annotation text font.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

LineEndingStyle

Gets or sets the line ending style of the text annotation.

public PdfLineEndingStyle LineEndingStyle { get; set; }

Property Value

PdfLineEndingStyle

The PdfLineEndingStyle object selects the different line ending styles of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

LineSpacing

Gets or sets value that indicates the vertical distance between the baselines of adjacent lines of text.

public float LineSpacing { get; set; }

Property Value

float

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Set the line spacing 
textAnnotation.LineSpacing = 5.5f;
textAnnotation.SetAppearance(true);
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Set the Line spacing.
textAnnotation.LineSpacing=5.5f
textAnnotation.SetAppearance(True)
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Remarks

Default value is 0.

See Also

MarkupText

Gets or sets the markup text of the text annotation

public string MarkupText { get; set; }

Property Value

string

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

ReviewHistory

Gets the annotation reviews

public PdfPopupAnnotationCollection ReviewHistory { get; }

Property Value

PdfPopupAnnotationCollection

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation freeTextAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation";
freeTextAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//set review state
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
freeTextAnnotation.ReviewHistory.Add(popup);
//Get Review history
PdfPopupAnnotationCollection reviewCollection = freeTextAnnotation.ReviewHistory;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim textAnnotationBounds As RectangleF = New RectangleF(10, 40, 100, 30)
Dim freeTextAnnotation As PdfFreeTextAnnotation = New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation"
freeTextAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
freeTextAnnotation.ReviewHistory.Add(popup)
Dim reviewCollection As PdfPopupAnnotationCollection = freeTextAnnotation.ReviewHistory
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
See Also

TextAlignment

Gets or sets the text alignment to free text annotations

public PdfTextAlignment TextAlignment { get; set; }

Property Value

PdfTextAlignment

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Sets the text alignment of the text annotation.
textAnnotation.TextAlignment = PdfTextAlignment.Right;
textAnnotation.setAppearance(true);
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
'Sets the text alignment of the text annotation.
textAnnotation.TextAlignment = PdfTextAlignment.Right
textAnnotation.setAppearance(true)
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

TextDirection

Gets or sets the text direction to free text annotation.

public PdfTextDirection TextDirection { get; set; }

Property Value

PdfTextDirection

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation freeTextAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation";
freeTextAnnotation.ComplexScript = true;
freeText.TextDirection = PdfTextDirection.RightToLeft;
freeTextAnnotation.Font = new PdfTrueTypeFont(new Font("Nirmala UI", 14), true);
//Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//set Comments state
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "أهلا بك";
freeTextAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = freeTextAnnotation.Comments;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim textAnnotationBounds As RectangleF = New RectangleF(10, 40, 100, 30)
Dim freeTextAnnotation As PdfFreeTextAnnotation = New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
freeTextAnnotation.MarkupText = "Text Annotation"
freeTextAnnotation.Font = New PdfTrueTypeFont(New Font("Nirmala UI", 14), True)
freeTextAnnotation.ComplexScript = True
freeText.TextDirection = PdfTextDirection.RightToLeft
'Set the line caption type.
freeTextAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "أهلا بك"
freeTextAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = freeTextAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
See Also

TextMarkupColor

Gets or sets the markup color of the text annotation.

public PdfColor TextMarkupColor { get; set; }

Property Value

PdfColor

The PdfColor draws the outline of the annotation.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF textAnnotationBounds = new RectangleF(10, 40, 100, 30);
//Create a new line annotation.
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(textAnnotationBounds);
//Set the text and font
textAnnotation.MarkupText = "Text Annotation";
textAnnotation.Font = new PdfStandardFont(PdfFontFamily.Courier, 10);
//Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout;
//Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond;
//Sets the points array to be called out the lines
textAnnotation.CalloutLines = new PointF[] { new PointF(0, 0), new PointF(1, 1) };
//Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red;
//Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple;
//Add this annotation to a new page.
page.Annotations.Add(textAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim textAnnotationBounds As New RectangleF(10, 40, 100, 30)
'Create a new line annotation.
Dim textAnnotation As New PdfFreeTextAnnotation(textAnnotationBounds)
'Set the text and font
textAnnotation.MarkupText = "Text Annotation"
textAnnotation.Font = New PdfStandardFont(PdfFontFamily.Courier, 10)
'Set the line caption type.
textAnnotation.AnnotationIntent = PdfAnnotationIntent.FreeTextCallout
'Set the line ending style.
textAnnotation.LineEndingStyle = PdfLineEndingStyle.Diamond
'Sets the points array to be called out the lines
 textAnnotation.CalloutLines = New PointF() {New PointF(0, 0), New PointF(1, 1)}
'Sets the markup color of the text annotation.
textAnnotation.TextMarkupColor = Color.Red
'Sets the border color of the text annotation.
textAnnotation.BorderColor = Color.Purple
'Add this annotation to a new page.
page.Annotations.Add(textAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

Methods

Initialize()

Initializes Annotation object.

protected override void Initialize()
See Also

Save()

Saves an Text Markup Annotation .

protected override void Save()
See Also

See Also