VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Pdf.Wpf.UI Namespace / WpfPdfContentXObjectTool Class
Members Example



In This Topic
    WpfPdfContentXObjectTool Class
    In This Topic
    Visual tool that allows to extract, select or remove images or forms on PDF page.
    Object Model
    WpfPdfContentXObjectTool ClassPdfPage ClassDeleteItemUIAction ClassWpfImageViewer Class
    Syntax
    'Declaration
     
    Public Class WpfPdfContentXObjectTool 
       Inherits WpfPdfVisualTool
       Implements Vintasoft.Imaging.UIActions.ISupportUIActions 
    public class WpfPdfContentXObjectTool : WpfPdfVisualTool, Vintasoft.Imaging.UIActions.ISupportUIActions  
    public __gc class WpfPdfContentXObjectTool : public WpfPdfVisualTool, Vintasoft.Imaging.UIActions.ISupportUIActions  
    public ref class WpfPdfContentXObjectTool : public WpfPdfVisualTool, Vintasoft.Imaging.UIActions.ISupportUIActions  
    Example
    This example 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 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 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: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also