Class PdfFreeTextAnnotation
Represents the PDF text annotation.
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfFreeTextAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged
Remarks
This PdfFreeTextAnnotation class is used to add the text directly on the page. Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-annotations#free-text-annotation for more details.
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)
Constructors
PdfFreeTextAnnotation(RectangleF)
Initializes a new instance of the PdfFreeTextAnnotation class with specified bounds.
Declaration
public PdfFreeTextAnnotation(RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | 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
Declaration
public PdfAnnotationIntent AnnotationIntent { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public PdfColor BorderColor { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public PointF[] CalloutLines { get; set; }
Property Value
Type | Description |
---|---|
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
Declaration
public PdfPopupAnnotationCollection Comments { get; }
Property Value
Type |
---|
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)
ComplexScript
Gets or sets the complex script to add different languages texts in free text annotation.
Declaration
public bool ComplexScript { get; set; }
Property Value
Type |
---|
System.Boolean |
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)
Font
Gets or sets the font of the text annotation
Declaration
public PdfFont Font { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public PdfLineEndingStyle LineEndingStyle { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public float LineSpacing { get; set; }
Property Value
Type |
---|
System.Single |
Remarks
Default value is 0.
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)
MarkupText
Gets or sets the markup text of the text annotation
Declaration
public string MarkupText { get; set; }
Property Value
Type |
---|
System.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
Declaration
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
Type |
---|
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)
TextAlignment
Gets or sets the text alignment to free text annotations
Declaration
public PdfTextAlignment TextAlignment { get; set; }
Property Value
Type |
---|
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)
TextDirection
Gets or sets the text direction to free text annotation.
Declaration
public PdfTextDirection TextDirection { get; set; }
Property Value
Type |
---|
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)
TextMarkupColor
Gets or sets the markup color of the text annotation.
Declaration
public PdfColor TextMarkupColor { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
protected override void Initialize()
Overrides
Save()
Saves an Text Markup Annotation .
Declaration
protected override void Save()