Table of Contents

Class PdfPopupAnnotationCollection

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents the collection of comments or reviews

public class PdfPopupAnnotationCollection : PdfCollection, IEnumerable
Inheritance
PdfPopupAnnotationCollection
Implements
Inherited Members

Examples

//Creates a new PDF Document.
PdfDocument document = new PdfDocument();
//Creates a new page
PdfPage page = document.Pages.Add();
//Creates a new rectangle
RectangleF attachmentRectangle = new RectangleF(10, 40, 30, 30);
//Creates a new attachment annotation.
PdfAttachmentAnnotation attachmentAnnotation = new PdfAttachmentAnnotation(attachmentRectangle, @"logo.png");
//Sets the attachment icon to attachment annotation.
attachmentAnnotation.Icon = PdfAttachmentIcon.PushPin;
PdfPopupAnnotation comments1 = new PdfPopupAnnotation();
comments1.Author = "Syncfusion";
comments1.Text = "Hello";
PdfPopupAnnotation comments2 = new PdfPopupAnnotation();
comments2.Author = "Pdf";
comments2.Text = "Welcome";
Set annotation comments to PdfPopupAnnoationCollection
PdfPopupAnnotationCollection commentscollection = attachmentAnnotation.Comments;
page.Annotations.Add(attachmentAnnotation);
commentscollection.Add(comments1);
comments1.Comments.Add(comments2);
document.Save("Output.pdf");
document.Close();
Dim document As PdfDocument = New PdfDocument
 Dim page As PdfPage = document.Pages.Add
 Dim attachmentRectangle As RectangleF = New RectangleF(10, 40, 30, 30)
 Dim attachmentAnnotation As PdfAttachmentAnnotation = New PdfAttachmentAnnotation(attachmentRectangle, "logo.png")
 'Sets the attachment icon to attachment annotation.
 attachmentAnnotation.Icon = PdfAttachmentIcon.PushPin
 Dim comments1 As PdfPopupAnnotation = New PdfPopupAnnotation
 comments1.Author = "Syncfusion"
 comments1.Text = "Hello"
 Dim comments2 As PdfPopupAnnotation = New PdfPopupAnnotation
 comments2.Author = "Pdf"
 comments2.Text = "Welcome"
 Dim commentscollection As PdfPopupAnnotationCollection = attachmentAnnotation.Comments
 page.Annotations.Add(attachmentAnnotation)
 commentscollection.Add(comments1)
 comments1.Comments.Add(comments2)
 document.Save("Output.pdf")
 document.Close

Properties

this[int]

Gets the PdfPopupAnnotation at the specified index.

public PdfPopupAnnotation this[int index] { get; }

Parameters

index int

Property Value

PdfPopupAnnotation

Examples

//Creates a new PDF Document.
PdfDocument document = new PdfDocument();
//Creates a new page
PdfPage page = document.Pages.Add();
//Creates a new rectangle
RectangleF attachmentRectangle = new RectangleF(10, 40, 30, 30);
//Creates a new attachment annotation.
PdfAttachmentAnnotation attachmentAnnotation = new PdfAttachmentAnnotation(attachmentRectangle, @"logo.png");
//Sets the attachment icon to attachment annotation.
attachmentAnnotation.Icon = PdfAttachmentIcon.PushPin;
PdfPopupAnnotation comments1 = new PdfPopupAnnotation();
comments1.Author = "Syncfusion";
comments1.Text = "Hello";
PdfPopupAnnotation comments2 = new PdfPopupAnnotation();
comments2.Author = "Pdf";
comments2.Text = "Welcome";
PdfPopupAnnotationCollection commentscollection = attachmentAnnotation.Comments;
page.Annotations.Add(attachmentAnnotation);
commentscollection.Add(comments1);
comments1.Comments.Add(comments2);
//Get the index value of PdfPopupAnnotationCollection
PdfPopupAnnotation getComments = commentscollection[0];
document.Save("Output.pdf");
document.Close();
Dim document As PdfDocument = New PdfDocument
 Dim page As PdfPage = document.Pages.Add
 Dim attachmentRectangle As RectangleF = New RectangleF(10, 40, 30, 30)
 Dim attachmentAnnotation As PdfAttachmentAnnotation = New PdfAttachmentAnnotation(attachmentRectangle, "logo.png")
 'Sets the attachment icon to attachment annotation.
 attachmentAnnotation.Icon = PdfAttachmentIcon.PushPin
 Dim comments1 As PdfPopupAnnotation = New PdfPopupAnnotation
 comments1.Author = "Syncfusion"
 comments1.Text = "Hello"
 Dim comments2 As PdfPopupAnnotation = New PdfPopupAnnotation
 comments2.Author = "Pdf"
 comments2.Text = "Welcome"
 Dim commentscollection As PdfPopupAnnotationCollection = attachmentAnnotation.Comments
 page.Annotations.Add(attachmentAnnotation)
 commentscollection.Add(comments1)
 comments1.Comments.Add(comments2)
 Dim getComments As PdfPopupAnnotation = commentscollection(0)
 document.Save("Output.pdf")
 document.Close

Methods

Add(PdfPopupAnnotation)

To add comments or reviews on the Annotation.

public void Add(PdfPopupAnnotation popupAnnotation)

Parameters

popupAnnotation PdfPopupAnnotation

Examples

//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page.
PdfPage page = document.Pages.Add();
document.PageSettings.SetMargins(0);
//Set the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 10f);
PdfBrush brush = new PdfSolidBrush(System.Drawing.Color.Black);
//Creates a new Rectangle annotation.
RectangleF rectannot = new RectangleF(0, 30, 100, 50);
PdfRectangleAnnotation rectangleannotation = new PdfRectangleAnnotation(rectannot, "RectangleAnnotation");
rectangleannotation.InnerColor = new PdfColor(Color.Red);
rectangleannotation.Color = new PdfColor(Color.Yellow);
page.Graphics.DrawString("Rectangle Annotation", font, brush, new PointF(0, 0));
//Add the annotation to the page
// Add review state
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
// Add comments and reviews
rectangleannotation.Comments.Add(popupComments);
rectangleannotation.ReviewHistory.Add(popup);
//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
document.PageSettings.SetMargins(0)
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 10!)
Dim brush As PdfBrush = New PdfSolidBrush(System.Drawing.Color.Black)
Dim rectannot As RectangleF = New RectangleF(0, 30, 100, 50)
Dim rectangleannotation As PdfRectangleAnnotation = New PdfRectangleAnnotation(rectannot, "RectangleAnnotation")
rectangleannotation.InnerColor = New PdfColor(Color.Red)
rectangleannotation.Color = New PdfColor(Color.Yellow)
page.Graphics.DrawString("Rectangle Annotation", font, brush, New PointF(0, 0))
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
' Add comments and reviews
rectangleannotation.Comments.Add(popupComments)
rectangleannotation.ReviewHistory.Add(popup)
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)

Remove(PdfPopupAnnotation)

Removes the reviews or comments

public void Remove(PdfPopupAnnotation popupAnnotation)

Parameters

popupAnnotation PdfPopupAnnotation

RemoveAt(int)

Removes the annotation comments or reviews at the specified index.

public void RemoveAt(int index)

Parameters

index int

Examples

//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page.
PdfPage page = document.Pages.Add();
document.PageSettings.SetMargins(0);
//Set the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 10f);
PdfBrush brush = new PdfSolidBrush(System.Drawing.Color.Black);
//Creates a new Rectangle annotation.
RectangleF rectannot = new RectangleF(0, 30, 100, 50);
PdfRectangleAnnotation rectangleannotation = new PdfRectangleAnnotation(rectannot, "RectangleAnnotation");
rectangleannotation.InnerColor = new PdfColor(Color.Red);
rectangleannotation.Color = new PdfColor(Color.Yellow);
page.Graphics.DrawString("Rectangle Annotation", font, brush, new PointF(0, 0));
//Add the annotation to the page
// Add review state
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
// remove comments and reviews
rectangleannotation.Comments.RemoveAt(0);
rectangleannotation.ReviewHistory.RemoveAt(0);
//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
document.PageSettings.SetMargins(0)
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 10!)
Dim brush As PdfBrush = New PdfSolidBrush(System.Drawing.Color.Black)
Dim rectannot As RectangleF = New RectangleF(0, 30, 100, 50)
Dim rectangleannotation As PdfRectangleAnnotation = New PdfRectangleAnnotation(rectannot, "RectangleAnnotation")
rectangleannotation.InnerColor = New PdfColor(Color.Red)
rectangleannotation.Color = New PdfColor(Color.Yellow)
page.Graphics.DrawString("Rectangle Annotation", font, brush, New PointF(0, 0))
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
' remove comments and reviews
rectangleannotation.Comments.RemoveAt(0)
rectangleannotation.ReviewHistory.RemoveAt(0)
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)