Search Results for

    Show / Hide Table of Contents

    Class TextAnnotation

    Creates interactive sticky-note annotations for PDF documents - like Post-it® notes for digital documents. Perfect for comments, review feedback, and collaborative document workflows.

    // Add simple comment:
    var comment = new TextAnnotation(0, "Review", "Please check figures") {
        X = 100, Y = 100,
        Color = Color.Yellow
    };
    pdf.Annotations.Add(comment);
    
    // Review annotation with metadata:
    var review = new TextAnnotation(pageIndex: 0) {
        Title = "John Smith",
        Subject = "Technical Review",
        Contents = "Algorithm needs optimization",
        X = 300, Y = 500,
        Color = Color.Red,
        OpenByDefault = true
    };
    pdf.Annotations.Add(review);
    
    // Hidden annotation for metadata:
    var metadata = new TextAnnotation(0, "Version", "v2.1.0") {
        Hidden = true,
        Printable = false
    };
    pdf.Annotations.Add(metadata);

    Annotations appear as icons that expand to show full text

    Some PDF viewers may not respect all properties

    See: https://ironpdf.com/how-to/annotations/

    Inheritance
    System.Object
    PdfClientAccessor
    TextAnnotation
    Implements
    IAnnotation
    Namespace: IronPdf.Annotations
    Assembly: IronPdf.dll
    Syntax
    public class TextAnnotation : PdfClientAccessor, IAnnotation

    Constructors

    TextAnnotation(Int32)

    Define a new annotation with the specified parameters. Annotation must be added to the document via PdfDocument.Annotations

    Declaration
    public TextAnnotation(int PageIndex)
    Parameters
    Type Name Description
    System.Int32 PageIndex

    Page index

    TextAnnotation(Int32, String, String)

    Define a new annotation with the specified parameters. Annotation must be added to the document via PdfDocument.Annotations

    Declaration
    public TextAnnotation(int PageIndex, string Title, string Contents)
    Parameters
    Type Name Description
    System.Int32 PageIndex

    Page index

    System.String Title

    Annotation title

    System.String Contents

    Annotation contents

    TextAnnotation(String, String)

    Define a new annotation with the specified parameters. Annotation must be added to the document via PdfDocument.Annotations

    Declaration
    public TextAnnotation(string Title, string Contents)
    Parameters
    Type Name Description
    System.String Title

    Annotation title

    System.String Contents

    Annotation contents

    Properties

    AnnotationIndex

    Gets or sets the zero-based index of this annotation on its page. Used internally to identify the annotation. Value of -1 indicates not yet added to document.

    Declaration
    public int AnnotationIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    Annotation index, or -1 if not added to document.

    Color

    The color of the annotation's 'Sticky Note' Note: Google Chrome PDF Viewer may not respect this color.
    However, Adobe PDF Viewer and Foxit PDF Viewer display the color correctly.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type Description
    IronSoftware.Drawing.Color

    Contents

    The contents of the 'sticky note' annotation

    Declaration
    public string Contents { get; set; }
    Property Value
    Type Description
    System.String

    Height

    Annotation visible height Note: Google Chrome or Adobe PDF Viewer may not respect this height.
    However, Foxit PDF Viewer handles the height correctly.

    Declaration
    public int Height { get; set; }
    Property Value
    Type Description
    System.Int32

    Hidden

    Hides the annotation from users

    Declaration
    public bool Hidden { get; set; }
    Property Value
    Type Description
    System.Boolean

    Opacity

    The opacity of the annotation (valid values are from 0.0 to 1.0)

    Declaration
    public double Opacity { get; set; }
    Property Value
    Type Description
    System.Double

    OpenByDefault

    Sets the annotation to be opened and readable by default, without user interaction

    Declaration
    public bool OpenByDefault { get; set; }
    Property Value
    Type Description
    System.Boolean

    PageIndex

    Gets or sets the zero-based page index where this annotation appears. Page 1 = index 0, Page 2 = index 1, etc. (default: 0 - first page).

    Declaration
    public int PageIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    Zero-based page index (default: 0).

    Printable

    Allows the annotation to be printed when users print the PDF

    Declaration
    public bool Printable { get; set; }
    Property Value
    Type Description
    System.Boolean

    ReadOnly

    Allows the annotation to be printed when users print the PDF

    Declaration
    public bool ReadOnly { get; set; }
    Property Value
    Type Description
    System.Boolean

    Rectangle

    The position and size of annotation.
    Note: Google Chrome or Adobe PDF Viewer may not respect the width and height.
    However, Foxit PDF Viewer handles the position and size correctly.

    Declaration
    public Rectangle Rectangle { get; set; }
    Property Value
    Type Description
    IronSoftware.Drawing.Rectangle

    Rotatable

    Allows the annotation to be rotated. E.g. when the containing page os rotated

    Declaration
    public bool Rotatable { get; set; }
    Property Value
    Type Description
    System.Boolean

    Subject

    The sub title of the annotation as displayed in the header of the 'sticky note'

    Declaration
    public string Subject { get; set; }
    Property Value
    Type Description
    System.String

    Title

    The main title of the annotation as displayed in the header of the 'sticky note'

    Declaration
    public string Title { get; set; }
    Property Value
    Type Description
    System.String

    Width

    Annotation visible width Note: Google Chrome or Adobe PDF Viewer may not respect this width.
    However, Foxit PDF Viewer handles the width correctly.

    Declaration
    public int Width { get; set; }
    Property Value
    Type Description
    System.Int32

    X

    Gets or sets the horizontal X position from the LEFT edge of the page, in points. 72 points = 1 inch. Example: X = 72 positions annotation 1 inch from left edge.

    Example:

    annotation.X = 100;  // 100 points from left edge

    Declaration
    public int X { get; set; }
    Property Value
    Type Description
    System.Int32

    Horizontal position in points from left edge (default: -1 if not set).

    Y

    Gets or sets the vertical Y position from the BOTTOM edge of the page, in points. 72 points = 1 inch. PDF coordinate system places Y=0 at bottom of page.

    Example:

    // Position annotation 2 inches from bottom:
    annotation.Y = 144;  // 144 points = 2 inches
    

    // Top of an 11-inch page (Letter size): annotation.Y = 792; // 11 × 72 = 792 points

    Declaration
    public int Y { get; set; }
    Property Value
    Type Description
    System.Int32

    Vertical position in points from bottom edge (default: -1 if not set).

    Methods

    ToString()

    Returns a System.String that represents this annotation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A System.String that represents this instance.

    Implements

    IAnnotation
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    IronPDF_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronPDF