Table of Contents

Class PdfPopupAnnotation

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

Represents a base class for popup annotation which can be either in open or closed state.

public class PdfPopupAnnotation : PdfAnnotation, INotifyPropertyChanged
Inheritance
PdfPopupAnnotation
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation(rectangle, "Test popup annotation")
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Constructors

PdfPopupAnnotation()

Initializes a new instance of the PdfPopupAnnotation class.

public PdfPopupAnnotation()

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation();
popupAnnotation.Text = "Test popup annotation";
popupAnnotation.Bounds = rectangle;
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation()
popupAnnotation.Text = "Test popup annotation"
popupAnnotation.Bounds = rectangle
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Remarks

Inner color property is not applicable for popup annotation, and we cannot resize text annotations for standard popup icons.

PdfPopupAnnotation(RectangleF)

Initializes a new instance of the PdfPopupAnnotation class with specified bounds.

public PdfPopupAnnotation(RectangleF rectangle)

Parameters

rectangle RectangleF

RectangleF structure that specifies 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 rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle);
popupAnnotation.Text = "Test popup annotation";
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation(rectangle)
popupAnnotation.Text = "Test popup annotation"
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

PdfPopupAnnotation(RectangleF, string)

Initializes a new instance of the PdfPopupAnnotation class with specified bounds and annotation text.

public PdfPopupAnnotation(RectangleF rectangle, string text)

Parameters

rectangle RectangleF

RectangleF structure that specifies the bounds of the annotation.

text string

The string specifies the annotation text.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation(rectangle, "Test popup annotation")
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Properties

Appearance

Gets or sets the appearance of the annotation.

public PdfAppearance Appearance { get; set; }

Property Value

PdfAppearance

The PdfAppearance object specifies the appearance of the annotaion.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
//Gets the appearance of popup annotation.
PdfAppearance appearance = popupAnnotation.Appearance;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation(rectangle, "Test popup annotation")
'Gets the appearance of popup annotation.
Dim appearance As PdfAppearance = popupAnnotation.Appearance
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Comments

Gets the annotation comments

public PdfPopupAnnotationCollection Comments { get; }

Property Value

PdfPopupAnnotationCollection

Examples

PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
//Creates a rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Creates a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Sets the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//set comments
PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
popupComments.Author = "TestAuthor";
popupComments.Text = "Test Text";
popupAnnotation.Comments.Add(popupComments);
//Get annotation comments
PdfPopupAnnotationCollection commentsCollection = popupAnnotation.Comments;
//Saves the document to disk.
doc.Save("Output.pdf");
doc.Close(true);
Dim doc As PdfDocument = New PdfDocument
Dim page As PdfPage = doc.Pages.Add
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
Dim popupAnnotation As PdfPopupAnnotation = New PdfPopupAnnotation(rectangle, "Test popup annotation")
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Sets the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
popupAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = popupAnnotation.Comments
'Saves the document to disk.
doc.Save("Output.pdf")
doc.Close(true)

Icon

Gets or sets icon style of the annotation.

public PdfPopupIcon Icon { get; set; }

Property Value

PdfPopupIcon

The PdfPopupIcon enumeration value which contains the different types of icons.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation(rectangle, "Test popup annotation")
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Set the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

IconName

Gets or sets the pop-up icon name to the text annotation.

public string IconName { get; set; }

Property Value

string

Examples

PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
//Creates a rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Creates a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
//Sets the custom icon name.
popupAnnotation.IconName = "Custom icon"; 
//Saves the document to disk.
doc.Save("Output.pdf");
doc.Close(true);
Dim doc As PdfDocument = New PdfDocument
Dim page As PdfPage = doc.Pages.Add
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
Dim popupAnnotation As PdfPopupAnnotation = New PdfPopupAnnotation(rectangle, "Test popup annotation")       
'Sets the custom icon name.
popupAnnotation..IconName = "Custom icon"    
'Saves the document to disk.
doc.Save("Output.pdf")
doc.Close(true)

Open

Gets or sets value whether annotation is initially open or closed.

public bool Open { get; set; }

Property Value

bool

Examples

True if the annotation is intially open, otherwise false.

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
//Set the Open to popupAnnotation.
popupAnnotation.Open = true;
//Add this annotation to a new page.
page.Annotations.Add(popupAnnotation);
//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 rectangle As New RectangleF(10, 40, 30, 30)
'Create a new popup annotation.
Dim popupAnnotation As New PdfPopupAnnotation(rectangle, "Test popup annotation")
'Set the Open to popupAnnotation.
popupAnnotation.Open = True
'Add this annotation to a new page.
page.Annotations.Add(popupAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

ReviewHistory

Gets the annotation reviews

public PdfPopupAnnotationCollection ReviewHistory { get; }

Property Value

PdfPopupAnnotationCollection

Examples

PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
//Creates a rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Creates a new popup annotation.
PdfPopupAnnotation popupAnnotation = new PdfPopupAnnotation(rectangle, "Test popup annotation");
popupAnnotation.Border.Width = 4;
popupAnnotation.Border.HorizontalRadius = 20;
popupAnnotation.Border.VerticalRadius = 30;
//Sets the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph;
//set Reviews
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
popupAnnotation.ReviewHistory.Add(popup);
//Get annotation comments
PdfPopupAnnotationCollection reviewCollection = popupAnnotation.ReviewHistory;
//Saves the document to disk.
doc.Save("Output.pdf");
doc.Close(true);
Dim doc As PdfDocument = New PdfDocument
Dim page As PdfPage = doc.Pages.Add
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
Dim popupAnnotation As PdfPopupAnnotation = New PdfPopupAnnotation(rectangle, "Test popup annotation")
popupAnnotation.Border.Width = 4
popupAnnotation.Border.HorizontalRadius = 20
popupAnnotation.Border.VerticalRadius = 30
'Sets the pdf popup icon.
popupAnnotation.Icon = PdfPopupIcon.NewParagraph
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
popupAnnotation.ReviewHistory.Add(popup)
Dim reviewCollection As PdfPopupAnnotationCollection = popupAnnotation.ReviewHistory
'Saves the document to disk.
doc.Save("Output.pdf")
doc.Close(true)

State

Gets or sets the annotation review State.

public PdfAnnotationState State { get; set; }

Property Value

PdfAnnotationState

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//To specify the line end points
int[] points = new int[] { 80, 420, 150, 420 };
//Create a new line annotation and set properties.
PdfLineAnnotation lineAnnotation = new PdfLineAnnotation(points);
lineAnnotation.Text = "Line Annotation";
//Create pdf line border
LineBorder lineBorder = new LineBorder();
lineBorder.BorderStyle = PdfBorderStyle.Solid;
lineBorder.BorderWidth = 1;
lineAnnotation.lineBorder = lineBorder;
lineAnnotation.LineIntent = PdfLineIntent.LineDimension;
//Add Review state
//set Review and comments
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Author = "Hello";
popup.Text = "Hello PDF Comments";
lineAnnotation.ReviewHistory.Add(popup);
//Add this annotation to a new page.
page.Annotations.Add(lineAnnotation);
lineAnnotation.ReviewHistory.Add(testreview);
//Save the document to disk.
document.Save("OutputLinePopup.pdf");
//close the document
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim points() As Integer = New Integer() { 80, 420, 150, 420}
Dim lineAnnotation As PdfLineAnnotation = New PdfLineAnnotation(points)
lineAnnotation.Text = "Line Annotation"
Dim lineBorder As LineBorder = New LineBorder
lineBorder.BorderStyle = PdfBorderStyle.Solid
lineBorder.BorderWidth = 1
lineAnnotation.lineBorder = lineBorder
lineAnnotation.LineIntent = PdfLineIntent.LineDimension
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Author = "Hello"
popup.Text = "Hello PDF Comments"
lineAnnotation.ReviewHistory.Add(popup)
'Add this annotation to a new page.
page.Annotations.Add(lineAnnotation)
lineAnnotation.ReviewHistory.Add(testreview)
'Save the document to disk.
document.Save("OutputLinePopup.pdf")
'close the document
document.Close(true)

StateModel

Gets or sets the annotation review State Model.

public PdfAnnotationStateModel StateModel { get; set; }

Property Value

PdfAnnotationStateModel

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//To specify the line end points
int[] points = new int[] { 80, 420, 150, 420 };
//Create a new line annotation and set properties.
PdfLineAnnotation lineAnnotation = new PdfLineAnnotation(points);
lineAnnotation.Text = "Line Annotation";
//Create pdf line border
LineBorder lineBorder = new LineBorder();
lineBorder.BorderStyle = PdfBorderStyle.Solid;
lineBorder.BorderWidth = 1;
lineAnnotation.lineBorder = lineBorder;
lineAnnotation.LineIntent = PdfLineIntent.LineDimension;
//Add Review state
//set Review and comments
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Author = "Hello";
popup.Text = "Hello PDF Comments";
lineAnnotation.ReviewHistory.Add(popup);
//Add this annotation to a new page.
page.Annotations.Add(lineAnnotation);
lineAnnotation.ReviewHistory.Add(testreview);
//Save the document to disk.
document.Save("OutputLinePopup.pdf");
//close the document
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim points() As Integer = New Integer() { 80, 420, 150, 420}
Dim lineAnnotation As PdfLineAnnotation = New PdfLineAnnotation(points)
lineAnnotation.Text = "Line Annotation"
Dim lineBorder As LineBorder = New LineBorder
lineBorder.BorderStyle = PdfBorderStyle.Solid
lineBorder.BorderWidth = 1
lineAnnotation.lineBorder = lineBorder
lineAnnotation.LineIntent = PdfLineIntent.LineDimension
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Author = "Hello"
popup.Text = "Hello PDF Comments"
lineAnnotation.ReviewHistory.Add(popup)
'Add this annotation to a new page.
page.Annotations.Add(lineAnnotation)
lineAnnotation.ReviewHistory.Add(testreview)
'Save the document to disk.
document.Save("OutputLinePopup.pdf")
'close the document
document.Close(true)

Methods

Initialize()

Initializes annotation object.

protected override void Initialize()

Save()

Saves an annotation.

protected override void Save()