IRONSOFTWAREHOME
Anmerkungen
using IronPdf;

// Create a new PDF or load and edit an existing document.
var pdf = PdfDocument.FromFile("existing.pdf");

int pageIndex1 = 0;
int pageIndex2 = 1;

// Create a PDF annotation object on a specified page index
var annotation1 = new IronPdf.Annotations.TextAnnotation(pageIndex1)
{
    Title = "This is the major title 1",
    Contents = "This is the long 'sticky note' comment 1st content...",
    X = 150,
    Y = 200,
    Width = 200,
    Height = 50,
    Opacity = 0.9,
    Printable = false,
    Hidden = false,
    OpenByDefault = true,
    ReadOnly = false,
    Rotatable = true
};

var annotation2 = new IronPdf.Annotations.TextAnnotation(pageIndex2)
{
    Title = "This is the major title 2",
    Contents = "This is the long 'sticky note' comment 2nd content...",
    X = 100,
    Y = 150,
    Width = 250,
    Height = 150,
    Opacity = 0.9,
    Printable = false,
    Hidden = false,
    OpenByDefault = true,
    ReadOnly = false,
    Rotatable = true
};

var annotation3 = new IronPdf.Annotations.TextAnnotation(pageIndex2)
{
    Title = "This is the major title 3",
    Contents = "This is the long 'sticky note' comment 3rd content...",
    X = 200,
    Y = 150,
    Width = 150,
    Height = 50,
    Opacity = 0.9,
    Printable = false,
    Hidden = false,
    OpenByDefault = true,
    ReadOnly = false,
    Rotatable = true
};

// Add the annotation "sticky note" within any new or existing PDF.
pdf.Annotations.Add(annotation1); // annotation1 index is 0.
pdf.Annotations.Add(annotation2); // annotation2 index is 1.
pdf.Annotations.Add(annotation3); // annotation3 index is 2.

// Remove a single annotation with specified index
pdf.Annotations.RemoveAt(1); // annotation2 is removed, annotation3 index becomes 1.

// Remove all annotaions on a specified page
pdf.Annotations.RemoveAllAnnotationsForPage(0); // remove all annotaion on page 1, annotation3 index becomes 0.

// Edit a single annotation with specified index
pdf.Annotations[0].Title = "new title for annotation 3";
pdf.Annotations[0].Contents = "This is new comment content of annotation 3";

// Remove all annotaions on the document
pdf.Annotations.Clear();

pdf.SaveAs("existing.pdf");
Imports IronPdf

' Create a new PDF or load and edit an existing document.
Dim pdf = PdfDocument.FromFile("existing.pdf")

Dim pageIndex1 As Integer = 0
Dim pageIndex2 As Integer = 1

' Create a PDF annotation object on a specified page index
Dim annotation1 = New IronPdf.Annotations.TextAnnotation(pageIndex1) With {
    .Title = "This is the major title 1",
    .Contents = "This is the long 'sticky note' comment 1st content...",
    .X = 150,
    .Y = 200,
    .Width = 200,
    .Height = 50,
    .Opacity = 0.9,
    .Printable = False,
    .Hidden = False,
    .OpenByDefault = True,
    .ReadOnly = False,
    .Rotatable = True
}

Dim annotation2 = New IronPdf.Annotations.TextAnnotation(pageIndex2) With {
    .Title = "This is the major title 2",
    .Contents = "This is the long 'sticky note' comment 2nd content...",
    .X = 100,
    .Y = 150,
    .Width = 250,
    .Height = 150,
    .Opacity = 0.9,
    .Printable = False,
    .Hidden = False,
    .OpenByDefault = True,
    .ReadOnly = False,
    .Rotatable = True
}

Dim annotation3 = New IronPdf.Annotations.TextAnnotation(pageIndex2) With {
    .Title = "This is the major title 3",
    .Contents = "This is the long 'sticky note' comment 3rd content...",
    .X = 200,
    .Y = 150,
    .Width = 150,
    .Height = 50,
    .Opacity = 0.9,
    .Printable = False,
    .Hidden = False,
    .OpenByDefault = True,
    .ReadOnly = False,
    .Rotatable = True
}

' Add the annotation "sticky note" within any new or existing PDF.
pdf.Annotations.Add(annotation1) ' annotation1 index is 0.
pdf.Annotations.Add(annotation2) ' annotation2 index is 1.
pdf.Annotations.Add(annotation3) ' annotation3 index is 2.

' Remove a single annotation with specified index
pdf.Annotations.RemoveAt(1) ' annotation2 is removed, annotation3 index becomes 1.

' Remove all annotations on a specified page
pdf.Annotations.RemoveAllAnnotationsForPage(0) ' remove all annotations on page 1, annotation3 index becomes 0.

' Edit a single annotation with specified index
pdf.Annotations(0).Title = "new title for annotation 3"
pdf.Annotations(0).Contents = "This is new comment content of annotation 3"

' Remove all annotations on the document
pdf.Annotations.Clear()

pdf.SaveAs("existing.pdf")
NuGet Download
PM > Install-Package IronPdf
Anmerkungen

Anmerkungen

PDF-Anmerkungen ermöglichen das Hinzufügen von Kommentaren wie "Haftnotizen" zu PDF-Seiten. Die IronPdf.PdfDocument.AddTextAnnotation-Methode und die PdfDocument.TextAnnotation-Klasse ermöglichen es, programmatisch Anmerkungen hinzuzufügen. Erweiterte Textanmerkungsfunktionen umfassen Farbgebung, Größenänderung, Opazität, Symbole und Bearbeitung.

Entdecken Sie, wie man mit IronPDF Anmerkungen zu PDFs hinzufügt
Auf GitHub ansehen

Bereit anzufangen?

Nuget Downloads 20,878,335Version:2026.9gerade veröffentlicht

Key in blue circle

Holen Sie sich sofort Ihren kostenlosen 30-Tage-Testschlüssel.

Your trial license will be sent to your email address

Keine Einschränkungen. 100 % freigeschaltet. Keine Kreditkarte.

bullet_checkedIhr Testlizenzschlüssel wurde Ihnen per E-Mail gesendet.Keine Einschränkungen. 100 % freigeschaltet. Keine Kreditkarte.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Buchen Sie Ihre kostenlose Live-Demo
Booking Badge

Von Millionen von Ingenieur*innen weltweit vertraut

Kundenlogos von Iron Software
Erhalten Sie Ihre unverbindliche Beratung
Füllen Sie das Formular unten aus oder senden Sie eine E-Mail an sales@ironsoftware.com
Ihre Daten werden immer vertraulich behandelt.
Von Millionen von Ingenieur*innen weltweit vertraut
Kundenlogos von Iron Software
Erhalten Sie sofort Ihren kostenlosen 30-Tage-Testschlüssel.
Ihr Testlizenzschlüssel wurde Ihnen per E-Mail gesendet.