Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfFreeTextAnnotation

    Show / Hide Table of Contents

    Class PdfFreeTextAnnotation

    Represents the PDF text annotation.

    Inheritance
    System.Object
    PdfAnnotation
    PdfFreeTextAnnotation
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    PdfAnnotation.SetAppearance(Boolean)
    PdfAnnotation.CalculateBounds(RectangleF, PdfPage, PdfLoadedPage)
    PdfAnnotation.SetValues(String, String)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate, Boolean, PdfGraphics)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate, Boolean)
    PdfAnnotation.CheckFlatten()
    PdfAnnotation.Color
    PdfAnnotation.Opacity
    PdfAnnotation.InnerColor
    PdfAnnotation.Border
    PdfAnnotation.Bounds
    PdfAnnotation.Location
    PdfAnnotation.Size
    PdfAnnotation.Page
    PdfAnnotation.Text
    PdfAnnotation.Author
    PdfAnnotation.Subject
    PdfAnnotation.ModifiedDate
    PdfAnnotation.AnnotationFlags
    PdfAnnotation.Flatten
    PdfAnnotation.FlattenPopUps
    PdfAnnotation.PdfTag
    PdfAnnotation.Layer
    PdfAnnotation.Rotate
    PdfAnnotation.Name
    PdfAnnotation.PropertyChanged
    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 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
    PdfPage

    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
    PdfPage

    BorderColor

    Declaration
    public PdfColor BorderColor { get; set; }
    Property Value
    Type Description
    PdfColor

    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
    PdfPage

    Comments

    Gets the annotation comments

    Declaration
    public PdfPopupAnnotationCollection Comments { get; }
    Property Value
    Type Description
    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 Description
    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
    PdfPage

    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
    PdfPage

    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 Description
    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 Description
    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
    PdfPage

    ReviewHistory

    Gets the annotation reviews

    Declaration
    public PdfPopupAnnotationCollection ReviewHistory { get; }
    Property Value
    Type Description
    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 Description
    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 Description
    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

    Declaration
    public PdfColor TextMarkupColor { get; set; }
    Property Value
    Type Description
    PdfColor

    Methods

    Initialize()

    Initializes Annotation object.

    Declaration
    protected override void Initialize()
    Overrides
    PdfAnnotation.Initialize()

    Save()

    Saves an Text Markup Annotation .

    Declaration
    protected override void Save()
    Overrides
    PdfAnnotation.Save()

    Implements

    System.ComponentModel.INotifyPropertyChanged

    See Also

    PdfPage
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved