FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
CreateAnnotAddon Class Reference

Annotation creates the add-on entry. More...

Public Member Functions

 constructor (pdfViewer)
 The constructor for constructing an instance of CreateAnnotAddon. More...
 
 init ({ showReplyDialog, hideReplyDialog, showPopup, hidePopup, showPropertiesDialog, hidePropertiesDialog, contextMenuIsEnable, }={})
 

Detailed Description

Annotation creates the add-on entry.

// Normal initialization
var createAnnotAddon = new PDFViewCtrl_CreateAnnotAddonModule.CreateAnnotAddon(pdfViewer);
createAnnotAddon.init();
// Initialization with custom parameters
var createAnnotAddon = new PDFViewCtrl_CreateAnnotAddonModule.CreateAnnotAddon(pdfViewer);
createAnnotAddon.init({
showReplyDialog: function () {
// The trigger is to double-click Annot
// It's this points to the AnnotComponent.
// If you call this.getModel(), you get PDF annot object.
alert(this.getModel().getContent())
},
hideReplyDialog: function () {
// The trigger is to delete or redraw Annot
// It's this points to the AnnotComponent
// If you call this.getModel(), you get PDF annot object.
},
showPopup: function () {
// The trigger time is to render Annot, and the popup of Annot is open
// It's this points to the AnnotComponent
// If you call this.getModel(), you get PDF annot object.
},
hidePopup: function () {
// The trigger time is to render Annot, and the popup of Annot is close or no popup
// It's this points to the AnnotComponent
// If you call this.getModel(), you get PDF annot object.
},
showPropertiesDialog: function () {
// Triggered when you right-click a property menu item in a menu
// It's this points to the AnnotComponent
// If you call this.getModel(), you get PDF annot object.
},
hidePropertiesDialog: function () {
// The trigger is to delete or redraw Annot
// It's this points to the AnnotComponent
// If you call this.getModel(), you get PDF annot object.
},
contextMenuIsEnable: function () {
// If you do not want the current right-click menu function, return false
// It's this points to the AnnotComponent
// If you call this.getModel(), you get PDF annot object.
return false;
}
});
// Currently only the following statehandler is supported
// Switch to Create Note Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_TEXT);
// Switch to Create Highlight Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_HIGHLIGHT);
// Switch to Create StrikeOut Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_STRIKE_OUT);
// Switch to Create Underline Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_UNDERLINE);
// Switch to Create Squiggly Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_SQUIGGLY);
// Switch to Create Replace Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_REPLACE);
// Switch to Create Caret Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_CARET);
// Switch to Create TypeWriter Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_FREETEXT_TYPEWRITER);
// Switch to Create FreeTextCallout Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_FREETEXT_CALLOUT);
// Switch to Create TextBox Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_FREETEXT_BOX);
// Switch to Create Square Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_SQUARE);
// Switch to Create Circle Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_CIRCLE);
// Switch to Create Line Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_LINE);
// Switch to Create Arrow Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_ARROW);
// Switch to Create Polygon Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_POLYGON);
// Switch to Create Polyline Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_POLYLINE);
// Switch to Create PolygonCloud Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_POLYGON_CLOUD);
// Switch to Create AreaHighlight Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_CREATE_AREA_HIGHLIGHT);
// Switch to Create Pencil Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_PENCIL);
// Switch to Create Eraser Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_ERASER);
// Switch to Create Stamp Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_STAMP, {
category, {string} [require] Collection of icons
name, {string} [require] name of icon
url, {string} [require] url for icon. It supports HTTP, file, blob url and base64 url.
fileType, {string} [optional=pdf] Icon file type.
width, {number} [optional=150] icon's width in PDF coordernary, default:150,
height, {number} [optional=45] icon's height in PDF coordernary, default:45,
showUrl {string} [optional=url] Create the view that was displayed before.
});
// Switch to Create FileAttachment Annotation StateHandler
pdfViewer.getStateHandlerManager().switchTo(PDFViewCtrl.constants.STATE_HANDLER_NAMES.STATE_HANDLER_CREATE_FILE_ATTACHMENT);
See also
PDFViewCtrl::constants::STATE_HANDLER_NAMES

Member Function Documentation

◆ constructor()

CreateAnnotAddon::constructor (   pdfViewer)
inline

The constructor for constructing an instance of CreateAnnotAddon.

Parameters
pdfViewerPDFViewer - The PDFViewer instance that owns this addon.
Since
9.0.0

◆ init()

CreateAnnotAddon::init (   { showReplyDialog, hideReplyDialog, showPopup, hidePopup, showPropertiesDialog, hidePropertiesDialog, contextMenuIsEnable, } = {})
inline

Initializing add-on

Parameters
[options]object - Initializing parameters for annotation add-ons
[options.showReplyDialog]()=>void - Customize the popover that displays the reply.
[options.hideReplyDialog]()=>void - Customize the popover for hidden replies.
[options.showPopup]()=>void - Customize the popover that displays the popup annotation.
[options.hidePopup]()=>void - Customize the popover for hidden the popup annotation.
[options.showPropertiesDialog]()=>void - Customize the popover that displays the annotation properties.
[options.hidePropertiesDialog]()=>void - Customize the popover for hidden the annotation properties.
[options.contextMenuIsEnable]()=>void - If you do not want the current right-click menu function, return false

Foxit Software Corporation Logo
@2024 Foxit Software Incorporated. All rights reserved.