VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree.Annotations Namespace / PdfPolylineAnnotation Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
PdfPolylineAnnotation Class
In This Topic
Represents a PDF annotation that displays a polyline.
Object Model
PdfPopupAnnotation PdfAnnotation PdfFileReferenceSpecificationList PdfAnnotationAppearanceGenerator PdfOptionalContentGroup PdfPage PdfAnnotationBorderStyle AffineMatrix PdfAction PdfAnnotationAppearances PdfAnnotationAdditionalActions PdfDocument PdfIndirectReference PdfBasicObject PdfPolylineAnnotation
Syntax
'Declaration

Public NotInheritable Class PdfPolylineAnnotation
   Inherits PdfPolygonalAnnotation

public sealed class PdfPolylineAnnotation : PdfPolygonalAnnotation

Example

Here is an example that shows how to create a PDF polyline annotation:


''' <summary>
''' Creates the PDF documenet with polyline annotation.
''' </summary>
''' <param name="outputPdfFilename">The output PDF filename.</param>
Public Shared Sub CreatePdfPolylineAnnotation(outputPdfFilename As String)
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(outputPdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14)
        Dim page As Vintasoft.Imaging.Pdf.Tree.PdfPage

        ' Add new page
        page = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4)
        page.Annotations = New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList(document)
        Dim annotationRectangle As System.Drawing.RectangleF = page.MediaBox
        annotationRectangle.Inflate(-200, -300)

        ' Points
        Dim random As New System.Random()
        Dim polylgonalAnnotationPoints As System.Drawing.PointF() = New System.Drawing.PointF(9) {}
        polylgonalAnnotationPoints(0) = annotationRectangle.Location
        For i As Integer = 1 To polylgonalAnnotationPoints.Length - 1
            polylgonalAnnotationPoints(i) = New System.Drawing.PointF(annotationRectangle.X + annotationRectangle.Width * CSng(random.NextDouble()), annotationRectangle.Y + annotationRectangle.Height * CSng(random.NextDouble()))
        Next

        ' Polyline annotation
        Dim polyline As New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolylineAnnotation(page)
        polyline.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, 30, 30)
        polyline.Points = polylgonalAnnotationPoints
        polyline.BorderWidth = 3
        polyline.InteriorColor = System.Drawing.Color.Red
        polyline.Color = System.Drawing.Color.Green
        polyline.StartPointLineEndingStyle = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationLineEndingStyle.ClosedArrow
        polyline.EndPointLineEndingStyle = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationLineEndingStyle.Diamond
        polyline.UpdateAppearance()
        page.Annotations.Add(polyline)

        document.SaveChanges()
    End Using
End Sub


/// <summary>
/// Creates the PDF documenet with polyline annotation.
/// </summary>
/// <param name="outputPdfFilename">The output PDF filename.</param>
public static void CreatePdfPolylineAnnotation(string outputPdfFilename)
{
    using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
        outputPdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14))
    {
        Vintasoft.Imaging.Pdf.Tree.PdfPage page;

        // Add new page
        page = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4);
        page.Annotations = new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList(document);
        System.Drawing.RectangleF annotationRectangle = page.MediaBox;
        annotationRectangle.Inflate(-200, -300);

        // Points
        System.Random random = new System.Random();
        System.Drawing.PointF[] polylgonalAnnotationPoints = new System.Drawing.PointF[10];
        polylgonalAnnotationPoints[0] = annotationRectangle.Location;
        for (int i = 1; i < polylgonalAnnotationPoints.Length; i++)
        {
            polylgonalAnnotationPoints[i] = new System.Drawing.PointF(
                annotationRectangle.X + annotationRectangle.Width * (float)random.NextDouble(),
                annotationRectangle.Y + annotationRectangle.Height * (float)random.NextDouble());
        }

        // Polyline annotation
        Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolylineAnnotation polyline = 
            new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolylineAnnotation(page);
        polyline.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, 30, 30);
        polyline.Points = polylgonalAnnotationPoints;
        polyline.BorderWidth = 3;
        polyline.InteriorColor = System.Drawing.Color.Red;
        polyline.Color = System.Drawing.Color.Green;
        polyline.StartPointLineEndingStyle = 
            Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationLineEndingStyle.ClosedArrow;
        polyline.EndPointLineEndingStyle = 
            Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationLineEndingStyle.Diamond;
        polyline.UpdateAppearance();
        page.Annotations.Add(polyline);

        document.SaveChanges();
    }
}

Inheritance Hierarchy

System.Object
   Vintasoft.Imaging.Pdf.Tree.PdfTreeNodeBase
      Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotation
         Vintasoft.Imaging.Pdf.Tree.Annotations.PdfMarkupAnnotation
            Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolygonalAnnotation
               Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolylineAnnotation

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also