VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Wpf.UI.Annotations Namespace / WpfPdfAnnotationTool Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
WpfPdfAnnotationTool Class
In This Topic
Visual tool that allows to view, fill and edit the annotations and interactive form fields of PDF document.
Object Model
PdfInteractiveFormEditorManager ImageCollectionDocumentSet PdfJsApp PdfJsDoc PdfActionExecutorBase PdfPage PdfAnnotationList WpfPdfAnnotationViewCollection PdfDocumentInteractiveForm PdfInteractiveFormField WpfPdfAnnotationView WpfPdfAnnotationView PdfAnnotation WpfRectangularSelectionTool CopyItemUIAction CutItemUIAction PasteItemWithOffsetUIAction DeleteItemUIAction SelectAllItemsUIAction DeselectAllItemsUIAction BringToBackItemUIAction BringToFrontItemUIAction IObjectClipboard IWpfInteractionController WpfImageViewer WpfPdfAnnotationTool
Syntax
'Declaration

<ToolboxItemAttribute("ToolboxItemType = null", "ToolboxItemTypeName = ")>
<DesignTimeVisibleAttribute("Visible = False")>
<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 WpfPdfAnnotationTool
   Inherits Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool

[ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
[DesignTimeVisible("Visible = False")]
[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 WpfPdfAnnotationTool : Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool

Example

This C#/VB.NET code shows how to create PDF annotation tool:


''' <summary>
''' Creates the PDF annotation tool.
''' </summary>
''' <param name="viewer">The image viewer.</param>
Public Shared Function CreatePdfAnnotationTool(viewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer) As Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool
    ' create PdfAnnotationTool
    Dim pdfAnnotationTool As New Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool(True)
    pdfAnnotationTool.InteractionMode = Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationInteractionMode.Markup

    ' create an application action executor
    Dim applicationActionExecutor As New Vintasoft.Imaging.Pdf.PdfActionCompositeExecutor()
    ' add executor for PdfGotoAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfGotoActionExecutor(viewer))
    ' add executor for PdfNamedAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfNamedActionExecutor(viewer))
    ' add executor for PdfResetFormAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolResetFormActionExecutor(pdfAnnotationTool))
    ' add executor for PdfAnnotationHideAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolAnnotationHideActionExecutor(pdfAnnotationTool))
    ' add executor for PdfUriAction to the application action executor,
    ' executor is located in WpfPdfDemosCommonCode
    'applicationActionExecutor.Items.Add(new PdfUriActionExecutor());
    ' add executor for PdfLaunchAction to the application action executor,
    ' executor is located in WpfPdfDemosCommonCode
    'applicationActionExecutor.Items.Add(new PdfLaunchActionExecutor());
    ' add executor for PdfSubmitFormAction to the application action executor,
    ' executor is located in WpfPdfDemosCommonCode
    'applicationActionExecutor.Items.Add(new PdfSubmitActionExecutor(viewer));
    ' add the default executor (for PdfResetFormAction and PdfAnnotationHideAction)
    ' to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.PdfActionExecutor())

    ' set the application action executor as action executor of PDF annotation tool
    pdfAnnotationTool.ActionExecutor = applicationActionExecutor

    Return pdfAnnotationTool
End Function
''' <summary>
''' Creates the PDF annotation tool with JavaScript support.
''' </summary>
''' <param name="viewer">The image viewer.</param>
Public Shared Function CreatePdfAnnotationToolWithJavaScriptSupport(viewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer) As Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool
    ' create PDF JavaScript application
    Dim jsApp As New Vintasoft.Imaging.Pdf.Wpf.UI.JavaScript.WpfPdfJsApp()
    ' add PDF documents, which are associated with images in viewer,
    ' to the document set of PDF JavaScript application
    jsApp.RegisterImageViewer(viewer)
    ' create PdfJavaScriptActionExecutor for PDF JavaScript application
    jsApp.ActionExecutor = New Vintasoft.Imaging.Pdf.JavaScript.PdfJavaScriptActionExecutor(jsApp, New Vintasoft.Imaging.Pdf.JavaScriptApi.PdfJsConsole())

    ' create PdfAnnotationTool
    Dim annotationTool As New Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool(jsApp, True)
    annotationTool.InteractionMode = Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationInteractionMode.Markup

    ' create an application action executor
    Dim applicationActionExecutor As New Vintasoft.Imaging.Pdf.PdfActionCompositeExecutor()
    ' add executor for PdfJavaScriptAction to the application action executor
    applicationActionExecutor.Items.Add(jsApp.ActionExecutor)
    ' add executor for PdfGotoAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfGotoActionExecutor(viewer))
    ' add executor for PdfNamedAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfNamedActionExecutor(viewer))
    ' add executor for PdfResetFormAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolResetFormActionExecutor(annotationTool))
    ' add executor for PdfAnnotationHideAction to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolAnnotationHideActionExecutor(annotationTool))
    ' add executor for PdfUriAction to the application action executor,
    ' executor is located in WpfPdfDemosCommonCode
    'applicationActionExecutor.Items.Add(new PdfUriActionExecutor());
    ' add executor for PdfLaunchAction to the application action executor,
    ' executor is located in WpfPdfDemosCommonCode
    'applicationActionExecutor.Items.Add(new PdfLaunchActionExecutor());
    ' add executor for PdfSubmitFormAction to the application action executor,
    ' executor is located in WpfPdfDemosCommonCode
    'applicationActionExecutor.Items.Add(new PdfSubmitActionExecutor(viewer));
    ' add the default executor (for PdfResetFormAction and PdfAnnotationHideAction)
    ' to the application action executor
    applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.PdfActionExecutor())

    ' set the application action executor as action executor of PDF annotation tool
    annotationTool.ActionExecutor = applicationActionExecutor

    ' create a document-level actions executor
    Dim documentLevelActionsExecutor As New Vintasoft.Imaging.Pdf.PdfDocumentLevelActionsExecutor(jsApp)
    ' set the application action executor as action executor of the document-level actions executor
    documentLevelActionsExecutor.ActionExecutor = applicationActionExecutor

    Return annotationTool
End Function


/// <summary>
/// Creates the PDF annotation tool.
/// </summary>
/// <param name="viewer">The image viewer.</param>
public static Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool CreatePdfAnnotationTool(
    Vintasoft.Imaging.Wpf.UI.WpfImageViewer viewer)
{
    // create PdfAnnotationTool
    Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool pdfAnnotationTool = 
        new Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool(true);
    pdfAnnotationTool.InteractionMode = Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationInteractionMode.Markup;

    // create an application action executor
    Vintasoft.Imaging.Pdf.PdfActionCompositeExecutor applicationActionExecutor = 
        new Vintasoft.Imaging.Pdf.PdfActionCompositeExecutor();
    // add executor for PdfGotoAction to the application action executor
    applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfGotoActionExecutor(viewer));
    // add executor for PdfNamedAction to the application action executor
    applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfNamedActionExecutor(viewer));
    // add executor for PdfResetFormAction to the application action executor
    applicationActionExecutor.Items.Add(
        new Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolResetFormActionExecutor(pdfAnnotationTool));
    // add executor for PdfAnnotationHideAction to the application action executor
    applicationActionExecutor.Items.Add(
        new Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolAnnotationHideActionExecutor(pdfAnnotationTool));
    // add executor for PdfUriAction to the application action executor,
    // executor is located in WpfPdfDemosCommonCode
    //applicationActionExecutor.Items.Add(new PdfUriActionExecutor());
    // add executor for PdfLaunchAction to the application action executor,
    // executor is located in WpfPdfDemosCommonCode
    //applicationActionExecutor.Items.Add(new PdfLaunchActionExecutor());
    // add executor for PdfSubmitFormAction to the application action executor,
    // executor is located in WpfPdfDemosCommonCode
    //applicationActionExecutor.Items.Add(new PdfSubmitActionExecutor(viewer));
    // add the default executor (for PdfResetFormAction and PdfAnnotationHideAction)
    // to the application action executor
    applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.PdfActionExecutor());

    // set the application action executor as action executor of PDF annotation tool
    pdfAnnotationTool.ActionExecutor = applicationActionExecutor;

    return pdfAnnotationTool;
}
/// <summary>
/// Creates the PDF annotation tool with JavaScript support.
/// </summary>
/// <param name="viewer">The image viewer.</param>
public static Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool CreatePdfAnnotationToolWithJavaScriptSupport(
    Vintasoft.Imaging.Wpf.UI.WpfImageViewer viewer)
{
    // create PDF JavaScript application
    Vintasoft.Imaging.Pdf.Wpf.UI.JavaScript.WpfPdfJsApp jsApp = 
        new Vintasoft.Imaging.Pdf.Wpf.UI.JavaScript.WpfPdfJsApp();
    // add PDF documents, which are associated with images in viewer,
    // to the document set of PDF JavaScript application
    jsApp.RegisterImageViewer(viewer);
    // create PdfJavaScriptActionExecutor for PDF JavaScript application
    jsApp.ActionExecutor = new Vintasoft.Imaging.Pdf.JavaScript.PdfJavaScriptActionExecutor(
        jsApp, new Vintasoft.Imaging.Pdf.JavaScriptApi.PdfJsConsole());

    // create PdfAnnotationTool
    Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool annotationTool = 
        new Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool(jsApp, true);
    annotationTool.InteractionMode = Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationInteractionMode.Markup;

    // create an application action executor
    Vintasoft.Imaging.Pdf.PdfActionCompositeExecutor applicationActionExecutor = 
        new Vintasoft.Imaging.Pdf.PdfActionCompositeExecutor();
    // add executor for PdfJavaScriptAction to the application action executor
    applicationActionExecutor.Items.Add(jsApp.ActionExecutor);
    // add executor for PdfGotoAction to the application action executor
    applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfGotoActionExecutor(viewer));
    // add executor for PdfNamedAction to the application action executor
    applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfNamedActionExecutor(viewer));
    // add executor for PdfResetFormAction to the application action executor
    applicationActionExecutor.Items.Add(
        new Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolResetFormActionExecutor(annotationTool));
    // add executor for PdfAnnotationHideAction to the application action executor
    applicationActionExecutor.Items.Add(
        new Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationToolAnnotationHideActionExecutor(annotationTool));
    // add executor for PdfUriAction to the application action executor,
    // executor is located in WpfPdfDemosCommonCode
    //applicationActionExecutor.Items.Add(new PdfUriActionExecutor());
    // add executor for PdfLaunchAction to the application action executor,
    // executor is located in WpfPdfDemosCommonCode
    //applicationActionExecutor.Items.Add(new PdfLaunchActionExecutor());
    // add executor for PdfSubmitFormAction to the application action executor,
    // executor is located in WpfPdfDemosCommonCode
    //applicationActionExecutor.Items.Add(new PdfSubmitActionExecutor(viewer));
    // add the default executor (for PdfResetFormAction and PdfAnnotationHideAction)
    // to the application action executor
    applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.PdfActionExecutor());

    // set the application action executor as action executor of PDF annotation tool
    annotationTool.ActionExecutor = applicationActionExecutor;

    // create a document-level actions executor
    Vintasoft.Imaging.Pdf.PdfDocumentLevelActionsExecutor documentLevelActionsExecutor =
       new Vintasoft.Imaging.Pdf.PdfDocumentLevelActionsExecutor(jsApp);
    // set the application action executor as action executor of the document-level actions executor
    documentLevelActionsExecutor.ActionExecutor = applicationActionExecutor;

    return annotationTool;
}

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.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
                              Vintasoft.Imaging.Pdf.Wpf.UI.Annotations.WpfPdfAnnotationTool

Requirements

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

See Also