Search Results for

    Show / Hide Table of Contents

    Interface IAnnotation

    PDF document annotation

    Namespace: IronPdf.Annotations
    Assembly: IronPdf.dll
    Syntax
    public interface IAnnotation

    IAnnotation is the contract you build against when adding annotations to a PDF through the IronPDF write-side annotation API. It supplies the polymorphic surface used by the PdfAnnotationCollection exposed on every PdfDocument. Two concrete classes implement it: TextAnnotation for interactive sticky-note review comments, and LinkAnnotation for clickable hyperlink overlays. The read-side PdfAnnotation hierarchy returned by PdfDocument.GetAnnotations is a separate type family and does not implement this interface.

    Code typed against IAnnotation works uniformly across the write-side annotation types, which is the value it adds to application code. A document review pipeline can build a mixed list of sticky notes and inline links, pass them through generic helpers, and only downcast when type-specific configuration is needed. The interface is also the contract that drives PdfAnnotationCollection, which derives from ObservableCollection<IAnnotation>, so iteration, enumeration, and LINQ over pdf.Annotations all return IAnnotation instances rather than concrete annotation types. To see the implementors put to work on a live document, follow the annotations how-to.

    Most of the surface is shared positioning and visibility state. The members that carry everyday use of the contract are PageIndex (which page the annotation belongs to, get-only on the interface and therefore fixed at construction time on the implementor), Title (the popup header for sticky notes or the descriptive label for link annotations), Contents (the annotation body text), and Hidden (the visibility flag viewers honor when rendering the page). The placement quartet X, Y, Width, Height (or the combined Rectangle) controls on-page geometry, Color controls the icon tint where applicable, AnnotationIndex is the diagnostic slot that switches from -1 to the assigned index after the annotation is attached, and DocumentId is populated by IronPDF when the annotation joins a document. Attach any IAnnotation to a PdfDocument through pdf.Annotations.Add(...) on the PdfAnnotationCollection returned by the read-only Annotations property.

    using IronPdf;
    using IronPdf.Annotations;
    
    // IAnnotation is the polymorphic write-side contract.
    // Build a mixed list of sticky notes and links, then attach them through one entry point.
    List<IAnnotation> markup = new()
    {
        new TextAnnotation(pageIndex: 0, Title: "Legal Review", Contents: "Verify clause 4.3.")
        {
            X = 72, Y = 720, Width = 200, Height = 60, Hidden = false
        },
        new LinkAnnotation(pageIndex: 0)
        {
            X = 72, Y = 640, Width = 200, Height = 20,
            Title = "Reference", Contents = "Linked source spec"
        }
    };
    
    var pdf = PdfDocument.FromFile("contract.pdf");
    
    foreach (IAnnotation note in markup)
    {
        pdf.Annotations.Add(note);
        // After Add, note.AnnotationIndex switches from -1 to its assigned slot.
    }
    
    pdf.SaveAs("contract-marked-up.pdf");

    A runnable version of this pattern lives in the annotations example. For details on the two concrete implementors, consult the TextAnnotation and LinkAnnotation class references.

    Properties

    AnnotationIndex

    Annotation index (of a given page)

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

    Color

    Annotation color

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

    Contents

    Annotation contents

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

    DocumentId

    Document identifier

    Declaration
    IDocumentId DocumentId { get; set; }
    Property Value
    Type Description
    IronSoftware.Abstractions.Pdf.IDocumentId

    Height

    Annotation height

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

    Hidden

    Annotation visibility status

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

    PageIndex

    Page index

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

    Rectangle

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

    Title

    Annotation title

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

    Width

    Annotation width

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

    X

    Annotation X position

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

    Y

    Annotation y position

    Declaration
    int Y { get; set; }
    Property Value
    Type Description
    System.Int32
    ☀
    ☾
    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