VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Tree.Annotations Namespace / PdfPolygonAnnotation Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс PdfPolygonAnnotation
    В этом разделе
    Представляет PDF аннотацию, отображающую многоугольник.
    Объектная модель
    PdfAnnotationBorderEffect PdfPopupAnnotation PdfAnnotation PdfFileReferenceSpecificationList PdfAnnotationAppearanceGenerator PdfOptionalContentGroup PdfPage PdfAnnotationBorderStyle AffineMatrix PdfAction PdfAnnotationAppearances PdfAnnotationAdditionalActions PdfDocument PdfIndirectReference PdfBasicObject PdfPolygonAnnotation
    Синтаксис
    'Declaration
    
    Public NotInheritable Class PdfPolygonAnnotation
       Inherits PdfPolygonalAnnotation
    
    
    public sealed class PdfPolygonAnnotation : PdfPolygonalAnnotation
    
    
    public __gc __sealed class PdfPolygonAnnotation : public PdfPolygonalAnnotation*
    
    
    public ref class PdfPolygonAnnotation sealed : public PdfPolygonalAnnotation^
    
    
    Пример

    Вот пример, показывающий, как создать многоугольную PDF аннотацию:

    
    ''' <summary>
    ''' Creates the PDF documenet with polygon annotation.
    ''' </summary>
    ''' <param name="outputPdfFilename">The output PDF filename.</param>
    Public Shared Sub CreatePdfPolygonAnnotation(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
    
            ' Polygon annotation
            Dim polygon As New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolygonAnnotation(page)
            polygon.BorderWidth = 3
            polygon.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, polygon.BorderWidth, polygon.BorderWidth)
            polygon.Points = polylgonalAnnotationPoints
            polygon.InteriorColor = System.Drawing.Color.Red
            polygon.Color = System.Drawing.Color.Green
            polygon.UpdateAppearance()
            page.Annotations.Add(polygon)
    
            document.SaveChanges()
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Creates the PDF documenet with polygon annotation.
    /// </summary>
    /// <param name="outputPdfFilename">The output PDF filename.</param>
    public static void CreatePdfPolygonAnnotation(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());
            }
    
            // Polygon annotation
            Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolygonAnnotation polygon = 
                new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfPolygonAnnotation(page);
            polygon.BorderWidth = 3;
            polygon.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle,
                polygon.BorderWidth, polygon.BorderWidth);
            polygon.Points = polylgonalAnnotationPoints;
            polygon.InteriorColor = System.Drawing.Color.Red;
            polygon.Color = System.Drawing.Color.Green;
            polygon.UpdateAppearance();
            page.Annotations.Add(polygon);
    
            document.SaveChanges();
        }
    }
    
    

    Иерархия наследования

    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.PdfPolygonAnnotation

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также