VintaSoft Imaging .NET SDK 12.3: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Wpf.UI Namespace / WpfPdfContentXObjectTool Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
    WpfPdfContentXObjectTool Class
    In This Topic
    Visual tool that allows to extract, select, transform, replace or remove images or forms on PDF page.
    Object Model
    DeleteItemUIAction PdfPage WpfImageViewer WpfPdfContentXObjectTool
    Syntax
    '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 WpfPdfContentXObjectTool
       Inherits WpfPdfVisualTool
       Implements ISupportUIActions
    
    
    [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 WpfPdfContentXObjectTool : WpfPdfVisualTool, ISupportUIActions
    
    
    [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 WpfPdfContentXObjectTool : public WpfPdfVisualTool*, ISupportUIActions
    
    
    [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 WpfPdfContentXObjectTool : public WpfPdfVisualTool^, ISupportUIActions
    
    
    Example

    This C#/VB.NET code shows how to highlight focused XObject in PDF document loaded into image viewer.

    
    ''' <summary>
    ''' A window that allows to load PDF document into image viewer and
    ''' highlight focused XObject in PDF document.
    ''' </summary>
    Public Partial Class WindowWithWpfPdfContentXObjectTool
        Inherits System.Windows.Window
        '...
    
        Private _imageViewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer
        Private _contentXObjectTool As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool
    
    
    
        Public Sub New()
            '...
    
            ' create an instance of the WpfPdfContentXObjectTool
            _contentXObjectTool = New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool()
    
            ' set a pen and brush for image selection
            _contentXObjectTool.SelectionImagesBrush = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 0, 255))
            _contentXObjectTool.SelectionImagesPen = New System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 1)
            ' set a pen and brush for form selection
            _contentXObjectTool.SelectionFormsBrush = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 255, 0))
            _contentXObjectTool.SelectionFormsPen = New System.Windows.Media.Pen(System.Windows.Media.Brushes.Blue, 1)
    
            ' subscribe to content XObject tool events
            AddHandler _contentXObjectTool.ContentXObjectMouseEnter, New System.EventHandler(Of Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)(AddressOf ContentXObjectTool_ContentXObjectMouseEnter)
            AddHandler _contentXObjectTool.ContentXObjectMouseLeave, New System.EventHandler(Of Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)(AddressOf ContentXObjectTool_ContentXObjectMouseLeave)
    
            ' set the content XObject tool as current tool
            _imageViewer.VisualTool = _contentXObjectTool
        End Sub
    
    
    
        ''' <summary>
        ''' Occurs when the mouse pointer enters the XObject on PDF page.
        ''' </summary>
        Private Sub ContentXObjectTool_ContentXObjectMouseEnter(sender As Object, e As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)
            ' add the focused XObject to the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Add(e.ContentXObject)
        End Sub
    
        ''' <summary>
        ''' Occurs when the mouse pointer leaves the XObject on PDF page.
        ''' </summary>
        Private Sub ContentXObjectTool_ContentXObjectMouseLeave(sender As Object, e As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)
            ' remove focused XObject from the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Remove(e.ContentXObject)
        End Sub
    
    End Class
    
    
    
    /// <summary>
    /// A window that allows to load PDF document into image viewer and
    /// highlight focused XObject in PDF document.
    /// </summary>
    public partial class WindowWithWpfPdfContentXObjectTool : System.Windows.Window
    {
        //...
    
        Vintasoft.Imaging.Wpf.UI.WpfImageViewer _imageViewer;
        Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool _contentXObjectTool;
        
        
        
        public WindowWithWpfPdfContentXObjectTool()
        {
            //...
    
            // create an instance of the WpfPdfContentXObjectTool
            _contentXObjectTool = new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool();
    
            // set a pen and brush for image selection
            _contentXObjectTool.SelectionImagesBrush = 
                new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 0, 255));
            _contentXObjectTool.SelectionImagesPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 1);
            // set a pen and brush for form selection
            _contentXObjectTool.SelectionFormsBrush = 
                new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 255, 0));
            _contentXObjectTool.SelectionFormsPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Blue, 1);
    
            // subscribe to content XObject tool events
            _contentXObjectTool.ContentXObjectMouseEnter +=
                new System.EventHandler<Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs>(ContentXObjectTool_ContentXObjectMouseEnter);
            _contentXObjectTool.ContentXObjectMouseLeave +=
                new System.EventHandler<Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs>(ContentXObjectTool_ContentXObjectMouseLeave);
    
            // set the content XObject tool as current tool
            _imageViewer.VisualTool = _contentXObjectTool;
        }
    
    
    
        /// <summary>
        /// Occurs when the mouse pointer enters the XObject on PDF page.
        /// </summary>
        private void ContentXObjectTool_ContentXObjectMouseEnter(
            object sender,
            Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs e)
        {
            // add the focused XObject to the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Add(e.ContentXObject);
        }
    
        /// <summary>
        /// Occurs when the mouse pointer leaves the XObject on PDF page.
        /// </summary>
        private void ContentXObjectTool_ContentXObjectMouseLeave(
            object sender,
            Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs e)
        {
            // remove focused XObject from the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Remove(e.ContentXObject);
        }
    
    }
    
    

    Inheritance Hierarchy

    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.Pdf.Wpf.UI.WpfPdfVisualTool
                                  Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool

    Requirements

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

    See Also