VintaSoft Imaging .NET SDK 12.0
In This Topic
    PdfAnnotationTool Class
    In This Topic
    A visual tool that allows to view, fill and edit the annotations and interactive form fields of PDF document.
    Object Model
    Vintasoft.Imaging.Spelling.SpellCheckManager Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormEditorManager Vintasoft.Imaging.Pdf.ImageCollectionDocumentSet Vintasoft.Imaging.Pdf.JavaScriptApi.PdfJsApp Vintasoft.Imaging.Pdf.JavaScriptApi.PdfJsDoc Vintasoft.Imaging.Pdf.PdfActionExecutorBase Vintasoft.Imaging.Pdf.Tree.PdfPage Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationViewCollection Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfDocumentInteractiveForm Vintasoft.Imaging.Pdf.Tree.InteractiveForms.PdfInteractiveFormField Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationView Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationView Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotation Vintasoft.Imaging.UI.VisualTools.RectangularSelectionTool Vintasoft.Imaging.UIActions.CopyItemUIAction Vintasoft.Imaging.UIActions.CutItemUIAction Vintasoft.Imaging.UIActions.PasteItemWithOffsetUIAction Vintasoft.Imaging.UIActions.DeleteItemUIAction Vintasoft.Imaging.UIActions.SelectAllItemsUIAction Vintasoft.Imaging.UIActions.DeselectAllItemsUIAction Vintasoft.Imaging.UIActions.BringToBackItemUIAction Vintasoft.Imaging.UIActions.BringToFrontItemUIAction Vintasoft.Imaging.Utils.IObjectClipboard Vintasoft.Imaging.UI.VisualTools.UserInteraction.IInteractionController Vintasoft.Imaging.UI.ImageViewer Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
    Syntax
    'Declaration
    
    Public Class PdfAnnotationTool
       Inherits UserInteractionVisualTool
    
    public class PdfAnnotationTool : UserInteractionVisualTool
    
    public __gc class PdfAnnotationTool : public UserInteractionVisualTool
    
    public ref class PdfAnnotationTool : public UserInteractionVisualTool
    
    Example

    This example shows how to create a 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.UI.ImageViewer) As Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
        ' create Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
        Dim annotationTool As New Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool(True)
        annotationTool.InteractionMode = Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationInteractionMode.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.UI.PdfGotoActionExecutor(viewer))
        ' add executor for PdfNamedAction to the application action executor
        applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.UI.PdfNamedActionExecutor(viewer))
        ' add executor for PdfResetFormAction to the application action executor
        applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolResetFormActionExecutor(annotationTool))
        ' add executor for PdfAnnotationHideAction to the application action executor
        applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolAnnotationHideActionExecutor(annotationTool))
        ' add executor for PdfUriAction to the application action executor,
        ' executor is located in WpfPdfDemosCommonCode
        'applicationActionExecutor.Items.Add(new PdfUriActionExecutor());// PdfDemosCommonCode
        ' add executor for PdfLaunchAction to the application action executor,
        ' executor is located in WpfPdfDemosCommonCode
        'applicationActionExecutor.Items.Add(new PdfLaunchActionExecutor());// PdfDemosCommonCode
        ' add executor for PdfSubmitFormAction to the application action executor,
        ' executor is located in WpfPdfDemosCommonCode
        'applicationActionExecutor.Items.Add(new PdfSubmitActionExecutor(viewer));// PdfDemosCommonCode
        ' 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
    
        Return annotationTool
    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.UI.ImageViewer) As Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
        ' create PDF JavaScript application
        Dim jsApp As New Vintasoft.Imaging.Pdf.UI.JavaScript.WinFormsPdfJsApp()
        ' 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 Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
        Dim annotationTool As New Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool(jsApp, True)
        annotationTool.InteractionMode = Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationInteractionMode.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.UI.PdfGotoActionExecutor(viewer))
        ' add executor for PdfNamedAction to the application action executor
        applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.UI.PdfNamedActionExecutor(viewer))
        ' add executor for PdfResetFormAction to the application action executor
        applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolResetFormActionExecutor(annotationTool))
        ' add executor for PdfAnnotationHideAction to the application action executor
        applicationActionExecutor.Items.Add(New Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolAnnotationHideActionExecutor(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.UI.Annotations.PdfAnnotationTool CreatePdfAnnotationTool(
        Vintasoft.Imaging.UI.ImageViewer viewer)
    {
        // create Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
        Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool annotationTool = new Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool(true);
        annotationTool.InteractionMode = Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationInteractionMode.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.UI.PdfGotoActionExecutor(viewer));
        // add executor for PdfNamedAction to the application action executor
        applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.UI.PdfNamedActionExecutor(viewer));
        // add executor for PdfResetFormAction to the application action executor
        applicationActionExecutor.Items.Add(
            new Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolResetFormActionExecutor(annotationTool));
        // add executor for PdfAnnotationHideAction to the application action executor
        applicationActionExecutor.Items.Add(
            new Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolAnnotationHideActionExecutor(annotationTool));
        // add executor for PdfUriAction to the application action executor,
        // executor is located in WpfPdfDemosCommonCode
        //applicationActionExecutor.Items.Add(new PdfUriActionExecutor());// PdfDemosCommonCode
        // add executor for PdfLaunchAction to the application action executor,
        // executor is located in WpfPdfDemosCommonCode
        //applicationActionExecutor.Items.Add(new PdfLaunchActionExecutor());// PdfDemosCommonCode
        // add executor for PdfSubmitFormAction to the application action executor,
        // executor is located in WpfPdfDemosCommonCode
        //applicationActionExecutor.Items.Add(new PdfSubmitActionExecutor(viewer));// PdfDemosCommonCode
        // 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;
    
        return annotationTool;
    }
    /// <summary>
    /// Creates the PDF annotation tool with JavaScript support.
    /// </summary>
    /// <param name="viewer">The image viewer.</param>
    public static Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool CreatePdfAnnotationToolWithJavaScriptSupport(Vintasoft.Imaging.UI.ImageViewer viewer)
    {
        // create PDF JavaScript application
        Vintasoft.Imaging.Pdf.UI.JavaScript.WinFormsPdfJsApp jsApp = 
            new Vintasoft.Imaging.Pdf.UI.JavaScript.WinFormsPdfJsApp();
        // 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 Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool
        Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool annotationTool = 
            new Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool(jsApp, true);
        annotationTool.InteractionMode = Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationInteractionMode.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.UI.PdfGotoActionExecutor(viewer));
        // add executor for PdfNamedAction to the application action executor
        applicationActionExecutor.Items.Add(new Vintasoft.Imaging.Pdf.UI.PdfNamedActionExecutor(viewer));
        // add executor for PdfResetFormAction to the application action executor
        applicationActionExecutor.Items.Add(
            new Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolResetFormActionExecutor(annotationTool));
        // add executor for PdfAnnotationHideAction to the application action executor
        applicationActionExecutor.Items.Add(
            new Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationToolAnnotationHideActionExecutor(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
       Vintasoft.Imaging.UI.VisualTools.VisualTool
          Vintasoft.Imaging.UI.VisualTools.UserInteraction.UserInteractionVisualTool
             Vintasoft.Imaging.Pdf.UI.Annotations.PdfAnnotationTool

    Requirements

    Target Platforms: .NET 6; .NET 5; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also