VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.UI Namespace / PdfContentEditorTool Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс PdfContentEditorTool
    В этом разделе
    Визуальный инструмент, позволяющий редактировать содержимое PDF страницы в просмотрщике изображений WinForms.
    Объектная модель
    FontProgramsControllerBase UndoManager PdfPage GraphicsFigure GraphicsFigureView GraphicsFigurePoints CopyItemUIAction CutItemUIAction PasteItemWithOffsetUIAction DeleteItemUIAction DeselectAllItemsUIAction BringToBackItemUIAction BringToFrontItemUIAction IObjectClipboard IInteractionController ImageViewer PdfContentEditorTool
    Синтаксис
    Пример

    Вот C#/VB.NET код, который демонстрирует, как добавить эллипс в PDF документ, который загружается в программу просмотра изображений.

    
    Public Partial Class FormWithPdfContentEditorTool
        Inherits System.Windows.Forms.Form
        '...
        Private _imageViewer As Vintasoft.Imaging.UI.ImageViewer
        '...
    
        ''' <summary>
        ''' The content editor tool.
        ''' </summary>
        Private _contentEditorTool As Vintasoft.Imaging.Pdf.UI.PdfContentEditorTool
    
        ''' <summary>
        ''' The undo manager.
        ''' </summary>
        Private _undoManager As New Vintasoft.Imaging.Undo.UndoManager(20)
    
        Public Sub New()
            '...
            ' initialize Vintasoft.Imaging.Pdf.Office.UI assembly
            Vintasoft.Imaging.PdfOfficeUIAssembly.Init()
    
            ' create visual tool that allows to edit content on PDF page
            _contentEditorTool = New Vintasoft.Imaging.Pdf.UI.PdfContentEditorTool()
    
            ' specify that content editor tool should add and edit content on PDF page
            _contentEditorTool.AppendMode = False
    
            ' specify that content editor tool should highlight content figures
            _contentEditorTool.FiguresHighlight = True
    
            ' disable figure rendering when current page is changed in image viewer
            _contentEditorTool.RenderFiguresWhenImageIndexChanging = False
    
            ' enable figure rendering when content editor tool is deactivating
            _contentEditorTool.RenderFiguresWhenDeactivating = True
    
            ' specify undo manager
            _contentEditorTool.UndoManager = _undoManager
    
            ' specify that visual tool should work only with content of specified types
            _contentEditorTool.InteractiveContentType = Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.Text Or Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.Image Or Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.Form Or Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.StrokePath Or Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.FillPath
    
            ' create visual tool that allows to edit text in text content on PDF page
            Dim contentEditorTextTool As New Vintasoft.Imaging.Office.OpenXml.UI.VisualTools.UserInteraction.OfficeDocumentVisualEditorTextTool()
    
            ' create the composite visual tool and set it as a current tool of image viewer
            _imageViewer.VisualTool = New Vintasoft.Imaging.UI.VisualTools.CompositeVisualTool(contentEditorTextTool, _contentEditorTool)
        End Sub
    
        '...
    
        Private Sub drawEllipseToolStripButton_Click(sender As Object, e As System.EventArgs)
            ' start building an ellipse
            _contentEditorTool.StartBuildEllipse(New Vintasoft.Imaging.Pdf.Drawing.PdfPen(System.Drawing.Color.Red, 5), New Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.Green))
        End Sub
    End Class
    
    
    
    public partial class FormWithPdfContentEditorTool : System.Windows.Forms.Form
    {
        //...
        Vintasoft.Imaging.UI.ImageViewer _imageViewer;
        //...
    
        /// <summary>
        /// The content editor tool.
        /// </summary>
        Vintasoft.Imaging.Pdf.UI.PdfContentEditorTool _contentEditorTool;
    
        /// <summary>
        /// The undo manager.
        /// </summary>
        Vintasoft.Imaging.Undo.UndoManager _undoManager = new Vintasoft.Imaging.Undo.UndoManager(20);
    
        public FormWithPdfContentEditorTool()
        {
            //...
            // initialize Vintasoft.Imaging.Pdf.Office.UI assembly
            Vintasoft.Imaging.PdfOfficeUIAssembly.Init();
    
            // create visual tool that allows to edit content on PDF page
            _contentEditorTool = new Vintasoft.Imaging.Pdf.UI.PdfContentEditorTool();
    
            // specify that content editor tool should add and edit content on PDF page
            _contentEditorTool.AppendMode = false;
    
            // specify that content editor tool should highlight content figures
            _contentEditorTool.FiguresHighlight = true;
    
            // disable figure rendering when current page is changed in image viewer
            _contentEditorTool.RenderFiguresWhenImageIndexChanging = false;
            
            // enable figure rendering when content editor tool is deactivating
            _contentEditorTool.RenderFiguresWhenDeactivating = true;
    
            // specify undo manager
            _contentEditorTool.UndoManager = _undoManager;
    
            // specify that visual tool should work only with content of specified types
            _contentEditorTool.InteractiveContentType =
                Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.Text |
                Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.Image |
                Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.Form |
                Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.StrokePath |
                Vintasoft.Imaging.Pdf.Drawing.GraphicsFigures.GraphicsFigureContentType.FillPath;
    
            // create visual tool that allows to edit text in text content on PDF page
            Vintasoft.Imaging.Office.OpenXml.UI.VisualTools.UserInteraction.OfficeDocumentVisualEditorTextTool contentEditorTextTool =
                new Vintasoft.Imaging.Office.OpenXml.UI.VisualTools.UserInteraction.OfficeDocumentVisualEditorTextTool();
    
            // create the composite visual tool and set it as a current tool of image viewer
            _imageViewer.VisualTool = new Vintasoft.Imaging.UI.VisualTools.CompositeVisualTool(contentEditorTextTool, _contentEditorTool);
        }
    
        //...
    
        private void drawEllipseToolStripButton_Click(object sender, System.EventArgs e)
        {
            // start building an ellipse
            _contentEditorTool.StartBuildEllipse(
                new Vintasoft.Imaging.Pdf.Drawing.PdfPen(System.Drawing.Color.Red, 5),
                new Vintasoft.Imaging.Pdf.Drawing.PdfBrush(System.Drawing.Color.Green));
        }
    }
    
    

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

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

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