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

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

    
    ''' <summary>
    ''' Creates the PDF documenet with free text annotation.
    ''' </summary>
    ''' <param name="outputPdfFilename">The output PDF filename.</param>
    Public Shared Sub CreatePdfFreeTextAnnotation(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)
    
            ' Free text annotation (without line)
            Dim freeText As New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfFreeTextAnnotation(page)
            freeText.Rectangle = annotationRectangle
            freeText.BorderWidth = 3
            freeText.Color = System.Drawing.Color.Green
            freeText.TextPadding = New Vintasoft.Imaging.PaddingF(freeText.BorderWidth)
            freeText.SetTextDefaultAppearance(document.FontManager.GetStandardFont(Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman), 20, System.Drawing.Color.Red)
            freeText.Contents = "Free text annotation (without line)"
            page.Annotations.Add(freeText)
            freeText.UpdateAppearance()
    
            ' Add new page
            page = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4)
            page.Annotations = New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList(document)
    
            ' Free text annotation (with line)
            freeText = New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfFreeTextAnnotation(page)
            freeText.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, 30, 30)
            freeText.BorderWidth = 3
            freeText.Color = System.Drawing.Color.Green
            freeText.TextPadding = New Vintasoft.Imaging.PaddingF(30 + freeText.BorderWidth, 30 + annotationRectangle.Height / 2, 30 + freeText.BorderWidth, 30 + freeText.BorderWidth)
            freeText.SetTextDefaultAppearance(document.FontManager.GetStandardFont(Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman), 20, System.Drawing.Color.Red)
            freeText.LineEndingStyle = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationLineEndingStyle.OpenArrow
            freeText.CalloutLinePoints = New System.Drawing.PointF() {New System.Drawing.PointF(annotationRectangle.X, annotationRectangle.Y + annotationRectangle.Height), New System.Drawing.PointF(annotationRectangle.X + annotationRectangle.Width / 2, annotationRectangle.Y + annotationRectangle.Height / 3F * 2F), New System.Drawing.PointF(annotationRectangle.X + annotationRectangle.Width / 2, annotationRectangle.Y + annotationRectangle.Height / 2)}
            freeText.Contents = "Free text annotation  (with line)"
            freeText.UpdateAppearance()
            page.Annotations.Add(freeText)
    
            document.SaveChanges()
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Creates the PDF documenet with free text annotation.
    /// </summary>
    /// <param name="outputPdfFilename">The output PDF filename.</param>
    public static void CreatePdfFreeTextAnnotation(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);
    
            // Free text annotation (without line)
            Vintasoft.Imaging.Pdf.Tree.Annotations.PdfFreeTextAnnotation freeText = 
                new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfFreeTextAnnotation(page);
            freeText.Rectangle = annotationRectangle;
            freeText.BorderWidth = 3;
            freeText.Color = System.Drawing.Color.Green;
            freeText.TextPadding = new Vintasoft.Imaging.PaddingF(freeText.BorderWidth);
            freeText.SetTextDefaultAppearance(
                document.FontManager.GetStandardFont(Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman),
                20,
                System.Drawing.Color.Red);
            freeText.Contents = "Free text annotation (without line)";
            page.Annotations.Add(freeText);
            freeText.UpdateAppearance();
    
            // Add new page
            page = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4);
            page.Annotations = new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList(document);
    
            // Free text annotation (with line)
            freeText = new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfFreeTextAnnotation(page);
            freeText.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, 30, 30);
            freeText.BorderWidth = 3;
            freeText.Color = System.Drawing.Color.Green;
            freeText.TextPadding = new Vintasoft.Imaging.PaddingF(
                30 + freeText.BorderWidth,
                30 + annotationRectangle.Height / 2,
                30 + freeText.BorderWidth,
                30 + freeText.BorderWidth);
            freeText.SetTextDefaultAppearance(
                document.FontManager.GetStandardFont(Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman),
                20,
                System.Drawing.Color.Red);
            freeText.LineEndingStyle = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationLineEndingStyle.OpenArrow;
            freeText.CalloutLinePoints = new System.Drawing.PointF[] { 
                new System.Drawing.PointF(
                    annotationRectangle.X, 
                    annotationRectangle.Y+annotationRectangle.Height),
                new System.Drawing.PointF(
                    annotationRectangle.X+annotationRectangle.Width / 2, 
                    annotationRectangle.Y+annotationRectangle.Height / 3f * 2f),
                new System.Drawing.PointF(
                    annotationRectangle.X+annotationRectangle.Width / 2, 
                    annotationRectangle.Y+annotationRectangle.Height / 2),
            };
            freeText.Contents = "Free text annotation  (with line)";
            freeText.UpdateAppearance();
            page.Annotations.Add(freeText);
    
            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.PdfFreeTextAnnotation

    Требования

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

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