VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Wpf.UI Namespace / WpfPdfContentEditorTool Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс WpfPdfContentEditorTool
    В этом разделе
    Визуальный инструмент, позволяющий редактировать содержимое PDF страницы в просмотрщике изображений WPF.
    Объектная модель
    FontProgramsControllerBase UndoManager PdfPage GraphicsFigure WpfGraphicsFigureView GraphicsFigurePoints CopyItemUIAction CutItemUIAction PasteItemWithOffsetUIAction DeleteItemUIAction DeselectAllItemsUIAction BringToBackItemUIAction BringToFrontItemUIAction IObjectClipboard IWpfInteractionController WpfImageViewer WpfPdfContentEditorTool
    Синтаксис
    'Declaration
    
    <DesignTimeVisibleAttribute("Visible = False")>
    <ToolboxItemAttribute("ToolboxItemType = null", "ToolboxItemTypeName = ")>
    <DefaultPropertyAttribute("Content")>
    <ContentPropertyAttribute("Content")>
    <LocalizabilityAttribute(None)>
    <StyleTypedPropertyAttribute("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")>
    <XmlLangPropertyAttribute("Name = Language")>
    <UsableDuringInitializationAttribute("Usable = True")>
    <RuntimeNamePropertyAttribute("Name = Name")>
    <UidPropertyAttribute()>
    <TypeDescriptionProviderAttribute("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")>
    <NameScopePropertyAttribute("Name = NameScope", "Type = System.Windows.NameScope")>
    Public Class WpfPdfContentEditorTool
       Inherits Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public class WpfPdfContentEditorTool : Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public __gc class WpfPdfContentEditorTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool*
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public ref class WpfPdfContentEditorTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool^
    
    
    Пример

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

    
    Public Partial Class WindowWithPdfEditorTool
        Inherits System.Windows.Window
        '...
        Private _imageViewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer
        Private _contentEditorTool As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentEditorTool
        '...
    
        Public Sub New()
            '...
            ' initialize Vintasoft.Imaging.Pdf.Office.UI assembly
            Vintasoft.Imaging.PdfOfficeWpfUIAssembly.Init()
    
            ' create visual tool that allows to edit content on PDF page
            _contentEditorTool = New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentEditorTool()
            ' create visual tool that allows to edit text in text content on PDF page
            Dim visualEditorTextTool As New Vintasoft.Imaging.Office.OpenXml.Wpf.UI.VisualTools.UserInteraction.WpfOfficeDocumentVisualEditorTextTool()
    
            ' 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
            ' 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 the composite visual tool and set it as a current tool of image viewer
            _imageViewer.VisualTool = New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfCompositeVisualTool(visualEditorTextTool, _contentEditorTool)
        End Sub
    
        '...
    
        Private Sub drawEllipseToolStripButton_Click(sender As Object, e As System.Windows.RoutedEventArgs)
            ' 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 WindowWithPdfEditorTool : System.Windows.Window
    {
        //...
        Vintasoft.Imaging.Wpf.UI.WpfImageViewer _imageViewer;
        Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentEditorTool _contentEditorTool;
        //...
    
        public WindowWithPdfEditorTool()
        {
            //...
            // initialize Vintasoft.Imaging.Pdf.Office.UI assembly
            Vintasoft.Imaging.PdfOfficeWpfUIAssembly.Init();
    
            // create visual tool that allows to edit content on PDF page
            _contentEditorTool = new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentEditorTool();
            // create visual tool that allows to edit text in text content on PDF page
            Vintasoft.Imaging.Office.OpenXml.Wpf.UI.VisualTools.UserInteraction.WpfOfficeDocumentVisualEditorTextTool visualEditorTextTool =
                new Vintasoft.Imaging.Office.OpenXml.Wpf.UI.VisualTools.UserInteraction.WpfOfficeDocumentVisualEditorTextTool();
    
            // 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;
            // 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 the composite visual tool and set it as a current tool of image viewer
            _imageViewer.VisualTool = new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfCompositeVisualTool(visualEditorTextTool, _contentEditorTool);
        }
    
        //...
    
        private void drawEllipseToolStripButton_Click(object sender, System.Windows.RoutedEventArgs 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));
        }
    }
    
    

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

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             System.Windows.Media.Visual
                System.Windows.UIElement
                   System.Windows.FrameworkElement
                      System.Windows.Controls.Control
                         System.Windows.Controls.ContentControl
                            Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool
                               Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
                                  Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentEditorTool

    Требования

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

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