menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfSquareMeasurementAnnotation - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PdfSquareMeasurementAnnotation

    Represents the annotation with Square Measurement.

    Inheritance
    System.Object
    PdfAnnotation
    PdfSquareMeasurementAnnotation
    Implements
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    PdfAnnotation.AnnotationFlags
    PdfAnnotation.Author
    PdfAnnotation.Bounds
    PdfAnnotation.CalculateBounds(RectangleF, PdfPage, PdfLoadedPage)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate, Boolean)
    PdfAnnotation.CalculateTemplateBounds(RectangleF, PdfPageBase, PdfTemplate, Boolean, PdfGraphics)
    PdfAnnotation.CheckFlatten()
    PdfAnnotation.Color
    PdfAnnotation.Flatten
    PdfAnnotation.FlattenPopUps
    PdfAnnotation.InnerColor
    PdfAnnotation.Layer
    PdfAnnotation.Location
    PdfAnnotation.ModifiedDate
    PdfAnnotation.Name
    PdfAnnotation.Opacity
    PdfAnnotation.Page
    PdfAnnotation.PdfTag
    PdfAnnotation.PropertyChanged
    PdfAnnotation.Rotate
    PdfAnnotation.SetAppearance(Boolean)
    PdfAnnotation.SetValues(String, String)
    PdfAnnotation.Size
    PdfAnnotation.Subject
    PdfAnnotation.Text
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Pdf.Interactive
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfSquareMeasurementAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged

    Constructors

    PdfSquareMeasurementAnnotation(RectangleF)

    Initializes new instance of PdfSquareMeasurementAnnotation class with bounds.

    Declaration
    public PdfSquareMeasurementAnnotation(RectangleF rectangle)
    Parameters
    Type Name Description
    System.Drawing.RectangleF rectangle

    Used to represent the bounds of the annotation

    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 Square annotation.
    PdfSquareMeasurementAnnotation squareannotation = new PdfSquareMeasurementAnnotation(new RectangleF(0, 30, 80, 80));
    squareannotation.Text = "SquareAnnotation";
    squareannotation.InnerColor = new PdfColor(Color.Red);
    LineBorder border = new LineBorder();
    border.BorderStyle = PdfBorderStyle.Solid;
    border.BorderWidth = 2;
    squareannotation.Border = border;
    squareannotation.Color = new PdfColor(Color.Yellow);
    page.Graphics.DrawString("Square Measurement Annotation", font, brush, new PointF(0, 0));
    //Add the annotation to the page.
    page.Annotations.Add(squareannotation);
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Creates a new PDF document.
    Dim document As PdfDocument = New PdfDocument()
    'Creates a new page 
    Dim page As PdfPage = document.Pages.Add()
    document.PageSettings.SetMargins(0)
    'Set the font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 10.0F)
    Dim brush As PdfBrush = New PdfSolidBrush(System.Drawing.Color.Black)
    'Creates a new Square annotation.
    Dim squareannotation As PdfSquareMeasurementAnnotation = New PdfSquareMeasurementAnnotation(New RectangleF(0, 30, 80, 80))
    squareannotation.Text = "SquareAnnotation"
    squareannotation.InnerColor = New PdfColor(Color.Red)
     Dim border As LineBorder = New LineBorder()
    border.BorderStyle = PdfBorderStyle.Solid
    border.BorderWidth = 2
    squareannotation.Border = border
    squareannotation.Color = New PdfColor(Color.Yellow)
    page.Graphics.DrawString("Square Measurement Annotation", font, brush, New PointF(0, 0))
    'Add annotation to the page.
    page.Annotations.Add(squareannotation)
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfPage
    PdfAnnotationCollection

    Properties

    Border

    Get or set the border style of the square annotaion.

    Declaration
    public LineBorder Border { get; set; }
    Property Value
    Type
    LineBorder
    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 Square annotation.
    PdfSquareMeasurementAnnotation squareannotation = new PdfSquareMeasurementAnnotation(new RectangleF(0, 30, 80, 80));
    squareannotation.Text = "SquareAnnotation";
    squareannotation.InnerColor = new PdfColor(Color.Red);
    LineBorder border = new LineBorder();
    border.BorderStyle = PdfBorderStyle.Solid;
    border.BorderWidth = 2;
    squareannotation.Border = border;
    squareannotation.Color = new PdfColor(Color.Yellow);
    page.Graphics.DrawString("Square Measurement Annotation", font, brush, new PointF(0, 0));
    //Add the annotation to the page.
    page.Annotations.Add(squareannotation);
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Creates a new PDF document.
    Dim document As PdfDocument = New PdfDocument()
    'Creates a new page 
    Dim page As PdfPage = document.Pages.Add()
    document.PageSettings.SetMargins(0)
    'Set the font.
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 10.0F)
    Dim brush As PdfBrush = New PdfSolidBrush(System.Drawing.Color.Black)
    'Creates a new Square annotation.
    Dim squareannotation As PdfSquareMeasurementAnnotation = New PdfSquareMeasurementAnnotation(New RectangleF(0, 30, 80, 80))
    squareannotation.Text = "SquareAnnotation"
    squareannotation.InnerColor = New PdfColor(Color.Red)
     Dim border As LineBorder = New LineBorder()
    border.BorderStyle = PdfBorderStyle.Solid
    border.BorderWidth = 2
    squareannotation.Border = border
    squareannotation.Color = New PdfColor(Color.Yellow)
    page.Graphics.DrawString("Square Measurement Annotation", font, brush, New PointF(0, 0))
    'Add annotation to the page.
    page.Annotations.Add(squareannotation)
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfPage
    PdfAnnotationCollection

    Comments

    Gets the annotation comments

    Declaration
    public PdfPopupAnnotationCollection Comments { get; }
    Property Value
    Type
    PdfPopupAnnotationCollection
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Create a new page.
    PdfPage page = document.Pages.Add();
    RectangleF rectangle = new RectangleF(10, 100, 100, 100);
    //Create a new square annotation and set properties.
    PdfSquareMeasurementAnnotation squareMeasureAnnotation = new PdfSquareMeasurementAnnotation(rectangle);
    //Assign author to the square measurement annotation
    squareMeasureAnnotation.Author = "Syncfusion";
    //Assign subject to the square measurement annotation
    squareMeasureAnnotation.Subject = "Square measurement annotation";
    //Assign color to the square measurement annotation
    squareMeasureAnnotation.Color = new PdfColor(Color.Red);
    //Assign measurement unit to the square measurement annotation
    squareMeasureAnnotation.Unit = PdfMeasurementUnit.Centimeter;
    //Add comment state
    PdfPopupAnnotation popupComments = new PdfPopupAnnotation();
    popupComments.Author = "TestAuthor";
    popupComments.Text = "Test Text";
    squareMeasureAnnotation.Comments.Add(popupComments);
    //Get annotation comments
    PdfPopupAnnotationCollection commentsCollection = squareMeasureAnnotation.Comments;
    page.Annotations.Add(squareMeasureAnnotation);
    //Saves the document to disk.
    document.Save("Output.pdf");
    document.Close(true);
    'Creates a new PDF document
    Dim document As New PdfDocument()
    'Creates a new page
    Dim page As PdfPage = document.Pages.Add()
    Dim rect As New RectangleF(10, 100, 100, 100)
    'Creates the square measurement annotation
    Dim squareMeasureAnnotation As New PdfSquareMeasurementAnnotation(rect)
    'Assign author to the square measurement annotation
    squareMeasureAnnotation.Author = "Syncfusion"
    'Assign subject to the square measurement annotation
    squareMeasureAnnotation.Subject = "Square measurement annotation"
    'Assign color to the square measurement annotation
    squareMeasureAnnotation.Color = New PdfColor(Color.Red)
    'Assign measurement unit to the square measurement annotation
    squareMeasureAnnotation.Unit = PdfMeasurementUnit.Centimeter
    Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
    popupComments.Author = "TestAuthor"
    popupComments.Text = "Test Text"
    squareMeasureAnnotation.Comments.Add(popupComments)
    Dim commentsCollection As PdfPopupAnnotationCollection = squareMeasureAnnotation.Comments
    page.Annotations.Add(squareMeasureAnnotation)
    'Saves the document to disk.
    document.Save("Output.pdf")
    document.Close(true)

    Font

    Gets or sets the font of the text annotation

    Declaration
    public PdfFont Font { get; set; }
    Property Value
    Type
    PdfFont

    ReviewHistory

    Gets the annotation reviews

    Declaration
    public PdfPopupAnnotationCollection ReviewHistory { get; }
    Property Value
    Type
    PdfPopupAnnotationCollection
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Create a new page.
    PdfPage page = document.Pages.Add();
    RectangleF rectangle = new RectangleF(10, 100, 100, 100);
    //Create a new square annotation and set properties.
    PdfSquareMeasurementAnnotation squareMeasureAnnotation = new PdfSquareMeasurementAnnotation(rectangle);
    //Assign author to the square measurement annotation
    squareMeasureAnnotation.Author = "Syncfusion";
    //Assign subject to the square measurement annotation
    squareMeasureAnnotation.Subject = "Square measurement annotation";
    //Assign color to the square measurement annotation
    squareMeasureAnnotation.Color = new PdfColor(Color.Red);
    //Assign measurement unit to the square measurement annotation
    squareMeasureAnnotation.Unit = PdfMeasurementUnit.Centimeter;
    //Add Review state
    PdfPopupAnnotation popup = new PdfPopupAnnotation();
    popup.State = PdfAnnotationState.Accepted;
    popup.StateModel = PdfAnnotationStateModel.Review;
    popup.Text = "Hello PDF Comments";
    popup.Author = "Test1";
    squareMeasureAnnotation.ReviewHistory.Add(popup);
    //Get Review history
    PdfPopupAnnotationCollection reviewCollection = squareMeasureAnnotation.ReviewHistory;
    page.Annotations.Add(squareMeasureAnnotation);
    //Saves the document to disk.
    document.Save("Output.pdf");
    document.Close(true);
    'Creates a new PDF document
    Dim document As New PdfDocument()
    'Creates a new page
    Dim page As PdfPage = document.Pages.Add()
    Dim rect As New RectangleF(10, 100, 100, 100)
    'Creates the square measurement annotation
    Dim squareMeasureAnnotation As New PdfSquareMeasurementAnnotation(rect)
    'Assign author to the square measurement annotation
    squareMeasureAnnotation.Author = "Syncfusion"
    'Assign subject to the square measurement annotation
    squareMeasureAnnotation.Subject = "Square measurement annotation"
    'Assign color to the square measurement annotation
    squareMeasureAnnotation.Color = New PdfColor(Color.Red)
    'Assign measurement unit to the square measurement annotation
    squareMeasureAnnotation.Unit = PdfMeasurementUnit.Centimeter
    Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
    popup.State = PdfAnnotationState.Accepted
    popup.StateModel = PdfAnnotationStateModel.Review
    popup.Text = "Hello PDF Comments"
    popup.Author = "Test1"
    squareMeasureAnnotation.ReviewHistory.Add(popup)
    Dim reviewCollection As PdfPopupAnnotationCollection = squareMeasureAnnotation.ReviewHistory
    page.Annotations.Add(squareMeasureAnnotation)
    'Saves the document to disk.
    document.Save("Output.pdf")
    document.Close(true)

    Unit

    Get or set PdfMeasurement Unit.

    Declaration
    public PdfMeasurementUnit Unit { get; set; }
    Property Value
    Type
    PdfMeasurementUnit

    Methods

    Initialize()

    Initializes annotation object.

    Declaration
    protected override void Initialize()
    Overrides
    PdfAnnotation.Initialize()

    Save()

    Saves an annotation.

    Declaration
    protected override void Save()
    Overrides
    PdfAnnotation.Save()

    Implements

    System.ComponentModel.INotifyPropertyChanged
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved