Class: eViewerApp
Constructor
constructor(userName)
Summary:
The username in the eViewer v7 is mandatory to provide. By default, it is set to ‘Administrator’.
Set User Name
setUserName(userName)
Summary:
User can manipulate the default username and set the name of the user as per the choice.
Set User Type
setUserType(userType)
Summary:
Allows the user to set the type of user for redaction purposes.
Parameters:
- userType:
- Type: String
- Description: Contains the type of user (“NORMAL”, “SUPER_USER”, “VIEW_ONLY”) should be case sensitive.
Returns:
A promise object, which is resolved when the function finishes execution.
Load Viewer
loadViewer(containerID, scripts, styleSheets, fitStyle, options)
Summary:
Initialize the viewer GUI and load viewer inside a div.
Parameters:
- containerID:
- Type: String value
- Description: It will contain the div id.
- scripts:
- Type: String value
- Description: An array of string containing the URLs to viewer script files.
var scripts = [ './viewer/runtime.js', './viewer/polyfills.js', './viewer/scripts.js', './viewer/main.js', './js/events.js', ];
- styleSheets:
- Type: String value
- Description: An array of objects containing references to CSS files for viewer to load.
- href: href tag is mandatory for linking. The path can be an absolute path or a relative path.
- Corresponding attributes: Along with href, other corresponding attributes can be added, such as integrity and cross origin in the example given below.
var css = [ { href: './viewer/styles.css' }, { href: 'https://cdnjs.cloudflare.com/ajax/libs/fontawesome/5.15.1/css/all.min.css', integrity: 'sha512 +4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNy eRssA=', crossorigin: 'anonymous' }
- fitStyle [optional]:
- Type: String value
- Description: There will be two possible values:
- default: Height of the viewer is predefined.
- bestFit: Height of the viewer will be defined according to the container’s (device) height.
- options:
- Type: Object type
- Description: It controls the behaviour of handling right click events. It stores another object contextMenuOptions, that holds two attributes:
- overrideContextMenus: Boolean parameter which is, by default, set to false. When it sets to true, it overrides the default context menus at the provided locations.
- location: Array of strings with the names of locations to override. Permitted values: “documentView”, “pageThumbnails”, “docThumbnails”, “toolbar” or “docTab”.
options: { "contextMenuOptions": { "overrideContextMenus: true, "location": [ "documentView", "pageThumbnails", "docThumbnails", "toolbar", "docTab" ]} }
Returns:
Load viewer API returns a promise object which is resolved on successfully loading of the viewer.
Set Document End Point Options
setDocumentEndPointOptions(options, eViewerUrl, savingEndPoint, userName, ocrEndPoint)
Summary:
This API will set the end point options of the document.
Parameters:
- options:
- Type: JSON object
- Description: An object that contains an attribute:
- type: GET
- headers: An object having key value pairs of header name and value.
Example of headers:
headers: {Authorization: 'BearereyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OD kwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJS MeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'}
- savePayLoadType: A new optional attribute can now be passed in the options object. There are two possible values of this attribute:
- “application/json”
- “multipart/form-data”
By default, if not provided, value is “application/json”.
Example of options parameter:
let savePlType = "application/json"; // or "multipart/form-data" let options = { type: "GET", headers: { Authorization: "Bearer " + this.state.token, Accept: "application/octet-stream.", }, savePayLoadType: savePlType };
- eViewerUrl:
- Type: String value
- Description: URL to the eViewer server app in the below format:
<Protocol>://<IPAddress>:<PortNumber>/<ApplicationName>/<api>/<version>
Example: http://192.168.10.100:8988/eViewerServerv0.0.18/api/v1
- savingEndPoint:
- Type: String value / Function Object
- Description: If string value is provided then the format of the saving endpoint URL:
<Protocol>://<IPAddress>:<PortNumber>/<ApplicationName>/<MethodForSavingFileType>
Example: http://192.168.10.100:8988/eViewer/createTiffFile
A function object can be provided. The function object will receive a single parameter containing the updated document save object.
Parameter:
- response:
- Type: Document Save Object. Refer to “Document Save Object” for details.
- Description: The viewer expects a function object that accepts a document save object that the viewer will pass whenever the document is saved.
- response:
- userName:
- Type: String value
- Description: Name of the document in the eViewer application.
- ocrEndPoint:
- Type: String value
- Description: URL to the OCR engine REST Endpoint:
<Protocol>://<IPAddress>:<PortNumber>/<ApplicationName>/<api>/<version>
Example: http://192.168.10.100:8988/OCRServiceAPI-0.0.2/api/v1
Returns:
A promise object, which is resolved when the execution finishes.
Document Save Object
{ docContent: UInt8Array, annContent: JSON Object viewerDocID: "XYZ" clientDocID: "XYZ" name: nameOfFileIfAny pageCount: 12 mimeType: "application/pdf" isDocContentDirty: Boolean isAnnContentDirty: Boolean }
Attributes of Document Save Object:
- docContent: Updated document content as a UInt8 typed array.
- annContent: JSON object containing annotation data.
- viewerDocID: The ID of the document assigned by the viewer internally will be the same as clientDocID if it is passed at the time of loading the document.
- clientDocID: Optional document ID passed while loading the document. It will be empty if one is not passed while loading the document.
- name: Current Name / Description of the document passed while loading the document or after the document was loaded whichever is most recent.
- pageCount: Total pages in the updated document.
- mimeType: Type of document.
- isDocContentDirty: If the value is ‘true’, the document is considered modified.
- isAnnContentDirty: If the value is ‘true’, the annotation is considered modified.
Register License
registerLicense(licenseKey, licenseServerUrl)
Summary:
Validates and registers the license key for the eViewer v7.
Parameters:
- licenseKey:
- Type: String value
- Description: String based license key as provided by the sales team.
- licenseServerUrl:
- Type: String value
- Description: URL to the eViewer server app in the below format:
<Protocol>://<IPAddress>:<PortNumber>
Example: http://192.168.10.100:5000
Returns:
A promise object, which is resolved once the license key is validated.
Scanning Document
setScannerPluginURL(scannerPluginUrl)
Summary:
Set the URL of the scanner plugin which the user will download.
Parameters:
- scannerPluginUrl:
- Type: String value
- Description: It will store the absolute HTTP URL to download the scanner plugin.
Returns:
A promise object, which is resolved when the execution finishes.
Note: It is required to download the scanner plugin for calling this API. It can be skipped if the scanner plugin is already running and installed.
Toggle thumbnail
toggleThumbnail()
Summary:
Toggles the thumbnail panel to switch the thumbnail location in the viewer, to either the left or the right side of the document viewing area.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Align thumbnails
alignThumbnails(alignDirection)
Summary:
To align the thumbnail panel location in the viewer.
Parameters:
- alignDirection: “LEFT | RIGHT | TOP | BOTTOM”
- Type: String
- Description: Represents the direction of the thumbnail panel in the viewer either the left, right, top, or bottom.
Returns:
A promise object, which is resolved when the execution finishes.
Hide Annotations
hideAnnotations(hide)
Summary:
Hides all annotations.
Parameters:
- hide:
- Type: Boolean value
- Description: Set to ‘true’ to hide all annotations of the document.
Returns:
A promise object, which is resolved when the execution finishes.
Hide Thumbnail
hideThumbnails(hide)
Summary:
Show and hide the page or document thumbnails.
Parameters:
- hide:
- Type: Boolean value
- Description: It will tell the viewer when to hide the thumbnail.
Returns:
A promise object, which is resolved when the execution finishes.
Select Panning
selectPanning(pan)
Summary:
Enables/disables page panning.
Parameters:
- pan:
- Type: Boolean value
- Description: Set to ‘true’ to enable panning mode.
Returns:
A promise object, which is resolved when the execution finishes.
Add Buttons
addButtons(buttons)
Summary:
Add buttons to the document.
Parameters:
- buttons:
- Type: Array of objects
- Description: Store the value of each attribute of a button.
[ { id: "", name: "", alignment: "ribbonToolbar or leftToolbar or rightToolbar", iconUrl: "path to png icon from assets folder", parent: "View or Annotate or Insert or Redact", //Only to be specified if alignment is ribbonToolbar placementIndex: "Set the sequence in ascending order according to the respective placement index", } ]
Returns:
A promise object, which is resolved when the execution finishes.
Update Buttons
updateButtons(buttons)
Summary:
Update button needs to be called to up the state of an existing custom button.
Parameters:
- buttons:
- Type: Array of objects
- Description: Store the value of each attribute of a button.
[ { id: "", name: "", alignment: "ribbonToolbar or leftToolbar or rightToolbar", iconUrl: "path to png icon from assets folder", parent: "View or Annotate or Insert or Redact", //Only to be specified if alignment is ribbonToolbar placementIndex: "Set the sequence in ascending order according to the respective placement index", } ]
Returns:
A promise object, which is resolved when the execution finishes.
Remove Buttons
removeButtons(buttons)
Summary:
Removes the button objects as provided in the buttons array.
Parameters:
- buttons:
- Type: Array of objects
- Description: Store the value of each attribute of a button.
[ { id: "", name: "", alignment: "ribbonToolbar or leftToolbar or rightToolbar", iconUrl: "path to png icon from assets folder", parent: "View or Annotate or Insert or Redact", //Only to be specified if alignment is ribbonToolbar placementIndex: "Set the sequence in ascending order according to the respective placement index", } ]
Returns:
A promise object, which is resolved when the execution finishes.
Get Document Service
getDocumentService()
Summary:
This instantiates and returns an object to the document service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Editing Service
getEditingService()
Summary:
This instantiates and returns an object to the editing service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Viewer Preference Service
getViewerPreferenceService()
Summary:
This instantiates and returns an object to the viewer preference service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Watermark Service
getWatermarkService()
Summary:
This instantiates and returns an object to the watermark service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Annotation Service
getAnnotationService()
Summary:
This instantiates and returns an object to the annotation service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Signature Service
getSignatureService()
Summary:
This instantiates and returns an object to the signature service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Redaction Service
getRedactionService()
Summary:
This instantiates and returns an object to the redaction service class.
Parameters:
No parameters.
Returns:
An object to the respective service class.
Get Icon Service
getIconService()
Summary:
This instantiates and returns an object to the icon service class.
Parameters:
No parameters.
Returns:
An object to the icon service class.
Get Icon Cache Manager Service
getIconCacheManagerService()
Summary:
This instantiates and returns an object to the icon service class.
Parameters:
No parameters.
Returns:
An object to the icon service class.
Get Doc MetaData Service
getDocMetaDataService()
Summary:
This instantiates and returns an object to the document metadata service class.
Parameters:
No parameters.
Returns:
An object to the document metadata service class.
On Document Tab Hover
onDocumentTabHover(callback)
Summary:
Hooks into the tab hover events.
Parameters:
- callback:
Description: Parameterized function object that is invoked every time a tab gets or loses focus which received the below parameters:- viewerDocID:
- Type: String
- Description: ID of the document.
- inFocus:
- Type: Boolean
- Description: When set to true, this indicates the tab is getting in focus.
- viewerDocID:
Hook into the tab focus events:
eviewerObj.onDocumentTabHover((viewerDocID, inFocus) => { // Your code goes here })
Returns:
Any Applicable.
Set Document Name Tooltip Direction
setDocumentNameTooltipDirection(direction)
Summary:
It is used to control the directions of a tooltip.
Parameters:
- direction:
- Type: String
- Description: The direction in which the tooltip needs to appear. It can have the following values:
- DEFAULT- eViewer decides the direction of a tooltip. That is the top or right side of the document tab.
- WEST- The tooltip appears on the left side of the document tab.
- EAST- The tooltip appears on the right side of the document tab.
- NORTH- The tooltip appears above the document tab.
- SOUTH- The tooltip appears below the document tab.
Returns:
A promise object, which is resolved when the execution finishes.
Add Content Security Policy
addContentSecurityPolicy(cspPolicy)
Summary:
It adds the content security policy headers to the webpage.
Parameters:
- cspPolicy:
- Type: String
- Description: It contains the content security policy that will be added to the header of the webpage.
Returns:
A promise object, which is resolved when the content security policy has been set.
For example,
{default-src=self, script-src=self, style-src=self, font-src=self, img-src=self, connect-src=self, reportOnly=report-uri /csp-report-endpoint/}
Class: DocumentService
Insert Document
insertDocument(file, options)
Summary:
Inserts a document in the viewer.
Parameters:
- file:
- Type: JSON object
- Description: File object that carries file information
{ name: “sample.pdf”, type: “application/pdf”, size: 10000 }
- options[optional]:
- Type: JSON object
- Description: Stores the information of filtered pages.
pageFilters: [{ "pageNo": 1, "visible": true }]
Returns:
A document ID in the promise object. After the promise object is resolved, it will show the filtered pages of the document.
Load Document
loadDocument(docUrl, annotationUrl, clientDocID, filename, options) [Deprecated] (Refer to new Load Document with Options API)
Summary:
Loads the document in viewer.
Parameters:
- docUrl:
- Type: String value
- Description: URL of the document stream to be loaded. It can be absolute URL or URL to any controller method that returns document stream.
- annotationUrl:
- Type: String value
- Description: URL of the annotation stream to be loaded with the document. It can be absolute URL or URL to any controller method that returns document stream
- clientDocID [optional]:
- Type: String value
- Description: Provide the client’s custom document ID. Passing clientDocID is optional, but it needs to be unique, if passed.
- fileName [optional]:
- Type: String value
- Description: Contains the name of the file to be displayed if loading documents via URL and URL does not contain file name in its last segment.
If there is a file name in the URL and user also provides the name in this parameter, then this name overwrites the name mentioned in the URL.
Example of a URL not containing file name: http://myserver/getFile/somefileID
- options:
- Type: JSON object
- Description:It will hold the information about various attributes:
- isEditMode [optional]: Stores the Boolean value to allow the annotation movement. By default, it sets to “true”.
- repoType [optional]: Stores the string value. By default, its value is “filesystem”.
- Password [optional]: Stores the string value to hold password. By default, it is an empty string.
- landingPage [optional]: Stores the Boolean value to allow the annotation movement. By default, its value is “1”.
- pageFilters [optional]: Stores the information of filtered pages including the page number and its visibility.
{ isEditMode: true, repoType: "filesystem", password: "", landingPage: 1, pageFilters: [{ "pageNo": 1, "visible": true }] }
Returns:
A promise object upon resolve, the viewerDocID created by viewer and the clientDocID that might be provided by the client, is passed to the observer.
{ viewerDocID: docId, clientDocID: uploadDetail, clientDocID "filesystem", }
After the promise object is resolved, it will show the filtered pages of the document.
Load Document With Options
loadDocumentWithOptions(docUrl, annotationUrl, clientDocID, options)
Summary:
Loads the document in the viewer.
Parameters:
- docUrl:
- Type: String value
- Description: URL of the document stream to be loaded. It can be an absolute URL or URL to any controller method that returns a document stream.
- annotationUrl:
- Type: String value
- Description: URL of the annotation stream to be loaded with the document. It can be an absolute URL or URL to any controller method that returns the document stream.
- clientDocID [optional]:
- Type: String value
- Description: Provide the client’s custom document ID. Passing clientDocID, optional, needs to be unique if passed.
- options:
- Type: JSON object
- Description:Holds the information about various attributes:
- isEditMode [optional]: Stores the Boolean value to allow the annotation movement. By default, it sets to “true”.
- repoType [optional]: Stores the string value. By default, its value is “filesystem”.
- Password [optional]: Stores the string value to hold the password. By default, it is an empty string.
- landingPage [optional]: Stores the Boolean value to allow the annotation movement. By default, its value is “1”.
- pageFilters [optional]: Stores the information of filtered pages including the page number and its visibility.
- groupName[optional]:
- Type: String
- Description: It will describe the group to which the document belongs.
- tabStyle[optional]:
- Type: Object
- Description: Style object for styling document’s tab. Refer to “Style Object” for details.
- focusTabStyle[optional]:
- Type: Object
- Description: Style object for styling document’s tab when in focus. Refer to “Style Object” for details.
- readOnly[optional]: Stores the Boolean value to prevent viewer from attempting to save the document. By default, it is set to “false”.
- thumbnailIconCallback[optional]: Stores the callback API that will be invoked by the viewer for fetching thumbnail icon objects. The callback API description is as follows:
- Description: A callback API with the below prototype:
Callback API:
Summary: Receives an array of thumbnail objects that are getting into view to control the thumbnail indicator for every page.
Parameters:- thumbnails:
- Type: Array of thumbnail objects.
- Description: Each thumbnail object holds the information of icon indicator regarding icon image, location, and hover text.
Callback API Returns: Updated array of thumbnails.
Callback API response example:[{ pgNo: 1 iconURL: "BASE64 encoded URL of PNG image", vLocation: "TOP | CENTER | BOTTOM", hLocation: "LEFT | RIGHT | CENTER", hoverText: "SOME TEXT GOES HERE", }, { pgNo: 2 iconURL: "BASE64 encoded URL of PNG image", vLocation: "TOP | CENTER | BOTTOM", hLocation: "LEFT | RIGHT | CENTER", hoverText: "SOME TEXT GOES HERE", }]
Returns: A promise object which is resolved, when the execution finishes.
{ isEditMode: true, repoType: "filesystem", password: "", landingPage: 1, pageFilters: [{ "pageNo": 1, " visible": true }], [{ pgNo: 1 iconURL: "BASE64 encoded URL of PNG image", vLocation: "TOP | CENTER | BOTTOM", hLocation: "LEFT | RIGHT | CENTER", hoverText: "SOME TEXT GOES HERE", }] }
- thumbnails:
- Description: A callback API with the below prototype:
Returns:
A promise object upon resolve, the viewerDocID created by the viewer and the clientDocID that might be provided by the client, is passed to the observer.
{ viewerDocID: docId, clientDocID: uploadDetail, clientDocID "filesystem", }
After the promise object is resolved, it will show the filtered pages of the document.
Style Object
The style object used to provide input to tab styling API’s
- backgroundColor [optional]:
- Type: String
- Description: It represents the background color of the tab. It stores the string value that contains the HEX color code.
style.backgroundColor = “#396BF7”
- color [optional]:
- Type: String
- Description: It represents the color of the font. It stores the string value.
Note: The prefix (#) is mandatory for all three above attributes.
style.color = “#fff”
- fontWeight [optional]:
- Type: String
- Description: Set the font weight for an element. Can be set from 100 to 900. (Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold).
Set fontWeightProperty:
style.fontWeight = "900"
- fontStyle [optional]:
- Type: String
- Description: Sets the style of the font to normal, italic, or underline.
Set fontStyle property:
style.fontStyle = "normal | italic | underline"
- fileName [optional]:
- Type: String value
- Description: Contains the name of the file to be displayed if loading documents via URL and URL does not contain file name in its last segment. If there is a file name in the URL and the user also provides the name in this parameter, then this value overwrites the value mentioned in the URL.
Example: URL not containing a file name:
http://myserver/getFile/somefileID - icon [optional]:
- Type: String
- Description: Stores the BASE64 image of the icon to be displayed over the documents tab. The recommended size to add an icon is 16×16 pixels. It can be scaled up to 256×256 pixels.
An empty string will be considered as an action to set an empty icon, hence in case there is already a place in the document tab and the style object is passed with an empty icon, it will be unset.
Note: Not providing the icon attribute will not remove the previously set icon.
{ backgroundColor: "", color: "", fontWeight: "900", fontStyle: "normal | italic | underline", icon: "" }
Two new parameters will be introduced in the below existing API under the options object to add normal and focus tab styles while loading a document. If “focusTabStyle” is not provided it will default to “tabStyle”. If “tabStyle” is also not provided it will default to preferences. (i.e. as set via PreferenceService)
New Document
newDocument(filetype)
Summary:
Creates a new blank viewer document tab to which pages can be added through copy or paste operation and then it can be either saved as PDF or TIFF format. The default format type of this new document is PDF.
Parameters:
- filetype:
- Type: String value
- Description: It contains a string value for the document file type. Valid values are:
- TIFF
Returns:
A promise object, which is resolved when the execution finishes, and the object of viewerDocID as an attribute, is passed.
returns "{ viewerDocID: currentDocId }"
Get All Open Documents
getOpenDocuments ()
Summary:
Provides a list of all open documents.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes, and the array of viewerDocID and clientDocID are passed as an argument.
returns array of "{ viewerDocID: doc.docId, clientDocID: doc.clientDocID }"
Get Active Document
getActiveDocument()
Summary:
The currently visible document in eViewer’s document viewing area.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes, and the object of viewerDocID is passed as an argument.
returns "{ viewerDocID: activeDocID, clientDocID: clntDocID }"
Get Current Page
getCurrentPage()
Summary:
It returns the page number currently active in the viewer.
Parameters:
No parameters.
Returns:
A promise object upon resolve, the page number active in the viewer is passed to the observer in an object.
returns "{ currentPage: pgNo }"
Get Selected Pages
getSelectedPages(includeCurrentPage)
Summary:
It returns page numbers of pages selected by the user from thumbnails.
Parameters:
- includeCurrentPage:
- Type: Boolean
- Description: Set as true to include current page.
Returns:
A promise object upon resolve, the array of page numbers is passed to the observer in an object.
Example:
{response: [2,3]}
Set Selected Pages
setSelectedPages(pages)
Summary:
It selects the page numbers in the viewer for the current document.
Parameters:
- pages:
- Type: Array of numbers.
- Description: An array of page numbers that need to be selected in the viewer.
Returns:
A promise object which is resolved when the operation finishes.
Clear Selected Pages
clearSelectedPages()
Summary:
It clears the selection of pages from thumbnails.
Parameters:
No parameters.
Returns:
A promise object upon resolve, the current selected page number is passed to the observer in an object.
Example:
{response: 1}
Close Document
closeDocument(docId)
Summary:
Closes the document rendered in the viewer.
Parameters:
- docId:
- Type: String value
- Description: ID of the document to close.
Returns:
A promise object, which is resolved when the execution finishes, and viewerDocID of the document is passed as an argument.
returns { viewerDocID: docID }
Close All Documents
closeAllDocuments()
Summary:
Close all documents rendered in the viewer.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Save Document
saveDocument(requireDataInResponse)
Summary:
Save the selected document to the provided saving endpoint set via setDocumentSavingEndPoint API or can return the data during promise resolution if “requireDataInResponse” is set to true.
Parameters:
- requireDataInResponse:
- Type: Boolean value
- Description: Default false if not passed, can be set to true to get the data in response to promise resolution. If set to false then it will default to savingEndPoint.
Returns:
A promise object, which is resolved when the execution finishes and returns an Document Save Object to updated document information that include the document content as UInt8Array and its metadata. Refer to Document Save Object for details.
Save Documents
saveDocuments(docIDs, requireDataInResponse)
Summary:
Save the specific documents to the provided saving endpoint set via setDocumentSavingEndPoint API, or can return the data during promise resolution if “requireDataInResponse” is set to true.
Parameters:
- docIDs:
- Type: Array of string.
- Description: ID of the documents to save.
- requireDataInResponse:
- Type: Boolean value
- Description: Default false if not passed, can be set to true to get the data in response to promise resolution. If set to false then it will default to savingEndPoint.
Returns:
A promise object, which is resolved when the execution finishes and returns an array of Document Save Object to updated document information that includes the document content as UInt8Array and its metadata. Refer to Document Save Object for details.
Save All Documents
saveAllDocuments()
Summary:
Save all the documents to the provided saving endpoint using the setDocumentSavingEndPoint API.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Next Page Traversing
nextPage()
Summary:
Renders the page which is following the current page displayed.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Previous Page Traversing
prevPage()
Summary:
Renders the page which is previous the current page displayed.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
First Page Traversing
firstPage()
Summary:
Renders the first page of the document.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Last Page Traversing
lastPage()
Summary:
Renders the last page of the document.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Go to Page Traversing
gotoPage(pageNo)
Summary:
Navigates to the desired page of the document via the page number.
Parameters:
- pageNo:
- Type: Number value
- Description: Number type value from the user input.
Returns:
A promise object, which is resolved when the execution finishes.
Go to Document
gotoDocument(docID)
Summary:
To navigate to a specific document from multiple documents that are open in the viewer.
Parameters:
- docID:
- Type: String
- Description: Id of the document.
Returns:
A promise object, which is resolved when the execution finishes.
const docSrvc = this.eViewerObj.getDocumentService(); docSrvc.gotoDocument(docID).then(() => { console.log("navigated to document: " + docID); });
Go to Next Document
gotoNextDocument()
Summary:
To navigate to the next document from the current document. If the last document is already in focus, then there will be no change.
Parameters:
No Parameters
Returns:
A promise object, which is resolved when the execution finishes and returns the ID of the new document in focus.
const docSrvc = this.eViewerObj.getDocumentService(); docSrvc.gotoNextDocument().then((nextDocID) => { console.log("navigated to next document: " + nextDocID); });
Go to Previous Document
gotoPreviousDocument()
Summary:
To navigate to the previous document from the current document. If the first document is already in focus, then there will be no change.
Parameters:
No Parameters
Returns:
A promise object, which is resolved when the execution finishes and returns the ID of the new document in focus.
const docSrvc = this.eViewerObj.getDocumentService(); docSrvc.gotoPreviousDocument().then((previousDocID) => { console.log("navigated to previous document: " + previousDocID); });
Go to First Document
gotoFirstDocument()
Summary:
To navigate to the first document from the current document. If the first document is already in focus, then there will be no change.
Parameters:
No Parameters
Returns:
A promise object, which is resolved when the execution finishes and returns the ID of the new document in focus.
const docSrvc = this.eViewerObj.getDocumentService(); docSrvc.gotoLastDocument().then((firstDocID) => { console.log("navigated to first document: " + firstDocID); });
Go to Last Document
gotoLastDocument()
Summary:
To navigate to the last document from the current document. If the last document is already in focus, then there will be no change.
Parameters:
No Parameters
Returns:
A promise object, which is resolved when the execution finishes and returns the ID of the new document in focus.
const docSrvc = this.eViewerObj.getDocumentService(); docSrvc.gotoLastDocument().then((lastDocID) => { console.log("navigated to last document: " + lastDocID); });
Append Document
appendDocument(file, base64FileData)
Summary:
Append another document in the already displayed document.
Parameters:
- file:
- Type: JSON Object
- Description: File object that carries file information.
{ name: “sample.pdf”, type: “application/pdf”, size: 10000 }
- base64FileData:
- Type: Base 64 string value
- Description: Base64 string of the file content.
Returns:
A promise object, which is resolved when the execution finishes, and the page count is passed as an argument.
Get Page Count
getPageCount(docId)
Summary:
Gets the total number pages of a document.
Parameters:
- docId:
- Type: String value
- Description: The document ID of a document.
Returns:
A promise object, which is resolved when the execution finishes, and the total number of pages are passed as an argument.
Filter Pages
filterPages(docId, pageFilters)
Summary:
Filter the pages of the document. This API can be invoked anytime during the viewer session, however, only after the load document or the insert document promise object has been resolved.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- pageFilters:
- Type: Array of objects
- Description: Holds the information of filtered pages.
- pageNo:
- Type: Number
- Description: Stores the page number of the document.
- visible:
- Type: Boolean
- Description: Informs about the visibility of the page and if that page filtered or not.
pageFilters: [{ "pageNo": 1, "visible": true }]
Note: By default, the visible property of page is set as “true”. It means that the page value is visible until and unless any filter applied successfully.
Returns:
A promise object, which is resolved when the execution finishes, and the total number of pages are passed as an argument.
{ "success": true, }
Show Only Pages
showOnlyPages(docId, pages)
Summary:
Show specified pages of the document and hide all others. If no pages are specified, then all pages will be displayed.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- pages:
- Type: Array of Numbers
- Description: Pages numbers that need to be rendered.
- Example: [1,2,3]
Returns:
A promise object upon resolve, an object is received which indicates the success of applied filters.
{ "success": true, }
Hide Only Pages
hideOnlyPages(docId, pages)
Summary:
Hide specified pages of the document and show all others. If no pages are specified, then all pages will be displayed.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- pages:
- Type: Array of Numbers
- Description: Pages numbers that need to be hidden.
- Example: [1,2,3]
Returns:
A promise object upon resolve, an object is received which indicates the success of applied filters.
{ "success": true, }
Get Active Document Info
getActiveDocumentInfo()
Summary:
Get the document information which is active or currently highlighted.
Parameters:
No parameters
Returns:
A promise object, upon being resolved, receives the highlighted document information.
{ "docId": "", "clientDocId": "", "docName": "", "size": 0, "pageCount": 0, "fileFormat": "PDF" }
File format can be: PDF, TIFF, PNG, JPG, BMP, GIF, TXT.
Get Page Info
getPageInfo(docId, pageRange) [Deprecated] (Refer to Get Page Info By Range API)
Summary:
Get the page information.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- pageRange:
- Type: String
- Description: Can hold a single page (i.e.1), comma separated page numbers (i.e.1,2,6), hyphen separated page range (i.e.1-6) or all pages.
Returns:
A promise object, upon being resolved, receives an array of objects containing all the information regarding page.
[{ "pageNo": 1, "visible": true, "height": 500, "width": 500, "xDPI": 96, "yDPI": 96, "bitDepth": 24 }]
Values of height and width will be in value of pixels. Bit Depth can be: 1, 4, 8, 16, 24, 32.
Get Page Info By Range
getPageInfoByRange(docId, pageRange)
Summary:
Get the information of single/page range/selected pages.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- pageRange:
- Type: Number / Array of numbers.
- Description: An array of page numbers for which information needs to be collected. A single page can be passed as a number.
Returns:
A promise object, upon being resolved, receives an array of objects containing all the information regarding queried page numbers.
[{ "pageNo": 1, "visible": true, "height": 500, "width": 500, "xDPI": 96, "yDPI": 96, "bitDepth": 24 }]
Values of height and width will be in value of pixels. Bit Depth can be: 1, 4, 8, 16, 24, 32.
Text Search
searchText(text)
Summary:
Search text in a document, and the results will be highlighted in the viewer.
Parameters:
- text:
- Type: String value
- Description: It holds the text that needs to be searched.
Returns:
A promise object, which is resolved when the execution finishes, and the total number of occurrences are passed as an argument.
Invert Pages
invertPages(pages)
Summary:
Inverts the pages of the document for the provided page numbers.
Parameters:
- pages:
- Type: Number / Array of numbers.
- Description: An array of page numbers to be inverted. A single page number also needs to be provided in an array format.
Returns:
A promise object, which is resolved when the execution finishes.
Set Document Tab Style
setDocumentTabStyle(viewerDocID, style, focusStyle)
Summary:
It is used to change the tab style.
Parameters:
- viewerDocID:
- Type: String
- Description: ID of the document.
- Style [optional]:
- Type: Object
- Description: It holds an object to the style object described under the section “Style Object”.
- focusStyle [optional]:
- Type: Object
- Description: It holds an object to the style object described under the section “Style Object”.
Returns:
A promise object, which is resolved when the execution finishes.
Get Document Tab Style
getDocumentTabStyle(viewerDocID)
Summary:
Returns the current normal and focus styles of the said document.
Parameters:
- viewerDocID:
- Type: String
- Description: ID of the document.
Returns:
A promise which when resolved will pass an object with both the normal and focus style objects.
docSrvc.getDocumentTabStyle(viewerDocId).then((response)=>{ }); Response Object: { style: {} focusStyle: {} }
Get Attachments
getAttachments(docId)
Summary:
This API will return the list of embedded OLE files present inside the office documents.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
Returns:
A promise object, that is resolved and returns a response. A response containing the array of objects. Each object has two attributes:
- content:
- Type: Uint8Array
- Description: It will contain the complete binary content of the attachment.
- name:
- Type: String
- Description: Contains the name of the attachment.
For example,
Set Document Scroll Mode
setDocumentScrollMode(docID, scrollMode)
Summary:
Set the scroll mode for the given document ID.
Parameters:
- docID:
- Type: String
- Description: ID of the document.
- scrollMode:
- Type: String
- Description: Can have two possible values “page” or “continuous”
Returns:
A promise object that when resolved marks the completion of the API.
Get Document Info
getDocumentInfo(docId)
Summary:
Get the document information.
Parameters:
- docID:
- Type: String
- Description: ID of the document.
Returns:
A promise object, upon being resolved, receives the document information.
{ "docId": "", "clientDocId": "", "docName": "", "size": 0, "pageCount": 0, "fileFormat": "PDF", isDocumentDirty: Boolean, isAnnotationDirty: Boolean }
File format can be: PDF, TIFF, PNG, JPG, BMP, GIF, TXT.
- Two attributes are added in this object that provide information on whether the document has been modified or not.
- If the isDocumentDirty value is ‘true’, the document will be considered modified.
- If the isAnnotationDirty value is ‘true’, the annotation will be considered modified within the document.
Get All Document Info
getAllDocumentInfo()
Summary:
Get the all document information.
Parameters:
No parameters
Returns:
A promise object, upon being resolved, returns an array of document information object for each document.
[{ "docId": "", "clientDocId": "", "docName": "", "size": 0, "pageCount": 0, "fileFormat": "PDF", isDocumentDirty: Boolean, isAnnotationDirty: Boolean }, …]
Set Dirty
setDirty(docID, dirty)
Summary:
To set the document “dirty” or “not dirty”.
Parameters:
- docID:
- Type: String
- Description: ID of the document.
- dirty:
- Type: Boolean
- Description: If the value is set to ‘true’, the document will be considered modified and marked dirty. If the value is set to ‘false’, the document will be considered unmodified.
Note: If changes are made to the document within the viewer itself, the asterisk will be displayed and will not be removed when the ‘dirty’ is set to ‘false’ because it is already being modified in the viewer.
Returns:
A promise, which is resolved when the execution finishes.
Set Groups Info
setGroupsInfo(groupDef)
Summary:
This API will define the groups.
Parameters:
- groupDef:
- Type: Object
- Description: It is an object type having the following attributes:
- groups:
- Type: Array of group definition objects
- Description: It is an array of group definition objects having the following attributes:
- name:
- Type: String
- Description: The group’s unique name must not be repeated. If repeated, it will ignore the latest name and use the existing name.
- color:
- Type: String, separated by comma’s
- Description: The color of the group (Red, Green, Blue)
- name:
- groups:
groupDef: { "groups": [ { name: "" [unique] color: "0,0,0" }, {} ] }
Returns:
A promise object, which is resolved when the function finishes execution.
Get Document Info By Group
getDocumentInfoByGroup(groupName)
Summary:
The API will provide the document information to which group it has been added.
Parameters:
- groupName:
- Type: String
- Description: The name of the group.
Returns:
A promise object, which is resolved when the function finishes execution and will return the Group Object.
Group Object
Description: It is an object type having the following attributes:
- groups:
- Type: Array of group object
- Description: It is an array of group objects having the following attributes:
- name:
- Type: String
- Description: The name of the group.
- documents:
- Type: Array, separated by commas
- Description: The name of the documents which belong to that group.
- name:
{ groups: [ { name: "", documents: ["","",""] } ] }
Get Groups Info
getGroupsInfo()
Summary:
This API will provide the group information.
Parameters:
No Parameters.
Returns:
A promise object, which is resolved when the function finishes execution and will return the group definition object.
Group Definition Object
Description: It is an object type having the following attributes:
- groups:
- Type: Array of group object
- Description: It is an array of group objects having the following attributes:
- name:
- Type: String
- Description: The group’s unique name must not be repeated. If repeated, it will ignore the latest one and use the existing name.
- color:
- Type: String, separated by comma’s
- Description: The color of the group (Red, Green, Blue)
- name:
{ "groups": [ { name: "" [unique] color: "0,0,0" }, {} ] }
Delete Group
deleteGroup(groupName)
Summary:
This API will delete the group and close all tabs within the group at once.
Parameters:
- groupName:
- Type: String
- Description: The name of the group.
Returns:
A promise object, which is resolved when the function finishes execution.
Ungroup
unGroup(groupName)
Summary:
This API will delete the group, but all tabs within the group will remain the same.
Parameters:
- groupName:
- Type: String
- Description: The name of the group.
Returns:
A promise object, which is resolved when the function finishes execution.
Class: EditingService
Zoom In
zoomIn()
Summary:
Zoom In API enlarges an area of the document viewing area.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes, and the current zoom percentage is passed as an argument.
Zoom Out
zoomOut()
Summary:
Zoom Out API makes the page view of the document smaller.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes, and the current zoom percentage is passed as an argument.
Rotate Clockwise
rotateClockwise()
Summary:
Rotates the current or selected pages of the document.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes.
Rotate Counter Clockwise
rotateCounterClockwise()
Summary:
Rotates the current or selected pages of the document by 90 degrees in the counterclockwise direction.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes and the current rotation angle of the page will be passed.
Rotate 180
rotate180()
Summary:
Rotates the current or selected pages of the document by 180 degrees.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes and the current rotation angle of the page will be passed.
Rotate By Angle
rotateByAngle(angle)
Summary:
Rotate the current page of the document in the clockwise direction with supported values only.
Parameters:
- angle:
- Type: Number
- Description: The supported rotation angle values are limited to 90, 180, or 270 degrees.
Returns:
A promise object, which is resolved when the execution finishes and the current rotation angle of the page will be passed.
Fit To Width, Fit To Window, Fit To Height, Actual Size
zoomTo(preset)
Summary:
Change the size of the page view according to the following requests: “Fit To Width”, “Fit To Window”, “Fit To Height”, or “Actual Size”.
Parameters:
- preset:
- Type: String value
- Description: Valid inputs are:
- Fit To Width
- Fit To Window
- Fit To Height
- Actual Size
Returns:
A promise object, which is resolved when the execution finishes, and the current zoom percentage is passed as an argument.
Delete Page
deletePage()
Summary:
Deletes the current or selected pages from the document.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes.
Copy Page
copyPage()
Summary:
Copies the selected page’s into the viewer’s clipboard.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes.
Cut Page
cutPage()
Summary:
Removes the current or selected page’s from the viewer and copies them into the viewer’s clipboard.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes.
Paste Page
pastePage()
Summary:
Paste’s the selected page/page’s from the viewer’s clipboard into the current document.
Parameters:
None
Returns:
A promise object, which is resolved when the execution finishes.
Snip Area
snipArea(options)
Summary:
Snip the selected area of the page and copy it into the viewer’s clipboard.
Parameters:
- options:
- Type: JSON object
- Description: An object that contains below five attributes:
- pageNo:
- Type: Number
- Description: The number of the page that needs to be snipped.
- startX:
- Type: Number
- Description: Stores the value of the start x coordinate.
- endX:
- Type: Number
- Description: Stores the value of the end x coordinate.
- startY:
- Type: Number
- Description: Stores the value of the start y coordinate.
- endY:
- Type: Number
- Description: Stores the value of the end y coordinate.
Returns:
A promise object, which is resolved when the execution finishes.
Native Document Downloading
nativeDocumentDownloading(docId, filename)
Summary:
To download the document in its native format over the browser.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- filename:
- Type: String
- Description: The name of the file.
Returns:
A promise object, which is resolved when the execution finishes.
Get Current Scale
getCurrentScale(docId)
Summary:
Get the current scale information.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
Returns:
A promise object, upon being resolved, receives the information about the document scale.
{ "docId": "", "scale": 1.0 "zoomPreset": "fitToWindow" }
The Scale describes the zoom value of the page. It can be calculated in percentage by multiplying by 100.
Example:
Value | Scale (%) |
0.5 | 50 |
1.0 | 100 |
1.5 | 150 |
Value of zoom pre-set can be “fitToWindow”, “fitToWidth” or “none”.
Get Current Rotation
getCurrentRotation(docId, pageNo)
Summary:
Get the current rotation information for a specific page of the document.
Parameters:
- docId:
- Type: String
- Description: ID of the document.
- pageNo:
- Type: Number
- Description: Stores page number of the document.
Returns:
A promise object, upon being resolved, receives the information about the document rotation.
{ "docId": "", "rotation": 90 }
Rotation defines the rotation angle of the page. The possible values for rotation angle are: 0, 90, 180, 270.
Export Document
exportDocument(exportData) [Deprecated] (Refer to Export Document With Options API)
Summary:
Export document will export the selected document with input options. It will open the PDF file directly.
Parameters:
- exportData:
- Type: JSON Object
- Description: This parameter takes a JSON object which contains the information to export a document. Following attributes as described below:
- docName: The name of the document.
- pageOption: The possible values of page option will be:
- currentPage: Current page will be exported.
- currentDocument: Current document will be exported.
- pageRange: Selected pages will be exported from the particular document according to the page range. It will search for ‘startPageExport’ and ‘endPageExport’ values.
- allDocuments: All the documents will be merged and exported.
Note: If this ‘pageOption’ string is empty, then it will search for the page range through ‘startPageExport’ and ‘endPageExport’ values.
- formName: It stores fixed string value; i.e. ‘export’.
- selectedOption: The possible values are ‘PDF’ or ‘Tiff’.
- startPageExport: The start page for exporting document. It will always be lesser or equal to ‘endPageExport’ value.
- endPageExport: The end page for exporting document. It will always be greater or equal to ‘startPageExport’ value.
- withAnn: This reads a string value, instead of ‘boolean’, to whether add the annotations in the exported document or not. If the string value is ‘true’, annotations should be definitely included in exporting, otherwise the value will be ‘false’.
- withComments: It stores the ‘boolean’ value, to whether add the comments in the exported document or not. If the value is ‘true’, comments should be definitely included in exporting, otherwise the value will be ‘false’.
- asStream: In case, the value is ‘false’, file will be downloaded otherwise the stream will be returned.
The schema of JSON is as follows:
{ "docName":"test.pdf", "pageOption": "allDocuments", "formName": "export", "selectedOption": "pdf", "startPageExport": 1, "endPageExport": 3, "withAnn": false, "withComments": false, "asStream": false, }
Returns:
A promise object, which is resolved when the execution finishes, and download the document to the browser.
Print Document
printDocument(printData) [Deprecated] (Refer to Export Document With Options API)
Summary:
Print document will print the selected document with input options.
Parameters:
- printData:
- Type: JSON object
- Description: This parameter takes a JSON object which contains the information to print a document. Following attributes as described below:
- docName: The name of the document.
- pageOption: The possible values of page option will be:
- currentPage: Current page will be printed.
- currentDocument: Current document will be printed.
- pageRange: Selected pages will be printed from the particular document according to the page range. It will search for ‘startPagePrint’ and ‘endPagePrint’ values.
- allDocuments: All the documents will be merged and printed.
Note: If this ‘pageOption’ string is empty, then it will search for the page range through ‘startPagePrint’ and ‘endPagePrint’ values.
- formName: It stores fixed string value; i.e. ‘print’.
- selectedOption: The possible values are ‘PDF’ or ‘Tiff’.
- startPagePrint: The start page for printing document. It will always be lesser or equal to ‘endPagePrint’ value.
- endPagePrint: The end page for printing document. It will always be greater or equal to ‘startPagePrint’ value.
- withAnn: This reads a string value, instead of ‘boolean’, to whether add the annotations in the printed document or not. If the string value is ‘true’, annotations should be definitely included in printing, otherwise the value will be ‘false’.
The schema of JSON is as follows:
{ "docName":"test.pdf", "pageOption": "currentDocument", "formName": "print", "selectedOption": "pdf", "startPageExport": 5, "endPageExport": 7, "withAnn": "true", }
Returns:
A promise object, which is resolved when the execution finishes.
Export Document With Options
docExportWithOptions (options)
Summary:
The export document will export the selected document with input options. It will open the PDF file directly.
Parameters:
- option:
- Type: JSON Object
- Description: This parameter takes a JSON object which contains the information to export a document. Following attributes as described below:
- exportType:
- Type: String
- Description: Type of export possible options can be any of the following:
- DOWNLOAD – Downloads the document to browse.
- EXPORT – Returns the binary typed array stream of the document that can be saved onto the desired location.
- PRINT – Prints the document onto the browser window.
- pageFilters:
- Type: String / Array of Numbers
- Description: Specifies page filters to select pages that will be exported. Developers can pass a preset as a string type or can pass an array of page numbers to be exported.
- Possible Values as String: “currentPage | currentDocument | selectedPages | allDocuments”
- currentPage: Current page will be exported.
- currentDocument: Current document will be exported.
- selectedPages: Pages selected by the user in thumbnails will be exported.
- allDocuments: All the documents will be merged and exported.
- exportAs:
- Type: String
- Description: Specifies exported file mime type.
- Possible Value: “PDF | TIFF”
- includeAnnotations:
- Type: Boolean
- Description: Exports document with or without annotations.
- downloadDocName [optional]:
- Type: String
- Description: The name of the document to be used when set to be downloaded.
- exportType:
The schema of JSON is as follows:
{ “exportType”: “DOWNLOAD | EXPORT | PRINT”, "pageFilters": "currentPage", "exportAs": "pdf", "includeAnnotations": true, "downloadDocName": "test.pdf", }
{ “exportType”: “DOWNLOAD | EXPORT | PRINT”, "pageFilters": [1,3,5], "exportAs": "pdf", "includeAnnotations": true, "downloadDocName": "test.pdf", }
Returns:
A promise object, which is resolved when the execution finishes.
Class: ViewerPreferenceService
Set User Preferences
setUserPreferences(preferences, shortcutPreferences)
Summary:
Set user preferences in the viewer settings.
Parameters:
- preferences:
- Type: JSON object
- Description: This parameter contains a JSON input.
- shortcutPreferences:
- Type: JSON object
- Description: An object to shortcut preferences. Shortcut preferences object would contain below attributes:
Shortcuts: It is an array of object and every object has three attributes:- Key: It provides shortcut patterns and assigned with respect to the command attribute. Combination of two keys will be separated by ‘+’ sign, so it is obligatory to add ‘+’ sign after every key within the combination.
- Command: It is fixed. It cannot be changed.
- Title: It can be according to the user’s choice.
For Example:
{ "shortcuts": [{"key": "Alt+=", "command": "zoomin", "title":"Zoom In"}] }
Returns:
A promise object, which is resolved when the execution finishes.
User Preferences Input JSON format:
{ "userInfo": { "userId": "ibRGHYys", "username": "Administrator" }, "leftDocToolbar": { "hideThumbnails": true, "panning": true, "zoom": true, "rotate": true, "fitToWindow": true, "fitToWidth": true, "actual": true, "rubberbandZoom": true }, "rightViewerToolbar": { "uploadDocument": true, "viewCheckpoints": true, "insertDocument": true, "settings": { "insertDocument": true, "exportDocument": true, "download": true, "print": true, "saveDocument": true, "newDocument": true }, "newDocument": true, "scanDocument": true, "closeFile": true, "closeAllFile": true, "saveDocument": true, "viewComments": true, "docMetadata": true, "attachments": true, "addNotes": true, "userPreferences": true, "info": true }, "rightDocToolbar": { "pageNavigation": true }, "thubmnailToolbar": { "popInOut": false }, "ribbonToolbar": [{ "name": "View", "isViewTabVisible": true, "children": { "split": true, "undo": true, "invert": true, "copyPgToClipboard": true, "thumbnailView": true, "sideBysideView": true, "textSearch": true, "selectText": true } }, { "name": "Insert", "isInsertTabVisible": true, "children": { "cutCopyPaste": true, "deletePage": true, "checkpoint": true, "appendDocument": true, "watermark": true, "snippingTool": true, "trimPage": true } }, { "name": "Annotate", "isAnnotationTabVisible": true, "children": { "line": true, "arrow": true, "circle": true, "rectangle": true, "pen": true, "highlight": true, "textAnnotation": true, "stamp": true, "polyLine": true, "polygon": true, "cloud": true, "stickynote": true, "button": true, "showHideAnn": true } }, { "name": "Redact", "isRedactTabVisible": true, "children": { "redactSelectText": true, "redactWord": true, "redaction": true, "searchRedact": true, "clearRedaction": true, "redactPage": true, "redactViewMode": true } }, { "name": "Signature", "isSignatureTabVisible": true, "children": { "drawSignature": true } }, { "name": "Speech", "isSpeechTabVisible": true, "children": { "previousPageSpeech": true, "play": true, "pause": true, "stop": true, "nextPageSpeech": true, "speechSpeed": true } }, { "name": "Compare", "isCompareTabVisible": true, "children": { "comparedocsView": true, "startSync": true, "closeComapreDocuments": true, "comaparePanel": true } }, { "name": "Medify", "isMedifyTabVisible": false, "children": { "addSnapshot": true, "openSnapshotAsNewDocument": true, "enableDisableCommentSubtitle": true } } ], "general": { "displayAnnIndicator": true, "view": "pageView", "zoomPreference": "actualControl", "newDocPre": "pdf", "switchThumb": "left", "isLogEnabled": false, "selectedOption": "info", "isOcrEnabled": true, "firstChunkSize": 1, "cacheManagerSize": 25, "waitTime": 5, "annComments": false, "showDocThumbBar": true, "showDocSignPanel": true, "autogrowDocTabWidth": false, "embedAnnotationOnStamping": true, "enablePDFLockAfterSigning": false, "pdfFlattening": false, "thumbnailZoomControls": true, "redactInJSON": true, "saveOnlyIfModified": false, "blockingSpinnerOnSave": false, "hideInViewerNotifications": false, "skipSaveCheckOnUnload": false, "enableHyperlinksByRegEx": "*", "saveAnnotationAsMimeType": "application/json" }, "docTabPreferences": { "focusTabStyle": { "backgroundColor": "#0853B5", "color": "#fff", "fontWeight": "400", "fontStyle": "normal", "fileName": "", "icon": "" }, "tabStyle": { "backgroundColor": "#f7f7f7", "color": "#545454", "fontWeight": "400", "fontStyle": "normal", "fileName": "", "icon": "" } }, "compareDocsPreference": { "detailPreference": { "fullDetail": false }, "displayPreference": { "textInfo": true, "imageInfo": false, "graphicsInfo": false, "annotInfo": false } } }
Let’s discuss the user preferences JSON input in more detail:
The eViewer v7 provides the access to the user to shuffle or hide the functionalities with their relevant icons. They can manage to rearrange or reorganize the icons as per their choice.
- Repositioning of Buttons:
User can change the positioning of buttons. They can shift a button and place them in any other toolbar.
- Reorganizing of Buttons:
User can reorganize the icons. They can modify the sequence of the buttons within the toolbar.
User needs to follow the pattern of the JSON input object, and provide the values accordingly.
NOTE:
- Upload document, Insert document and Scan document cannot be reshuffled because of the URL update. If user tries to rearrange any of them, then these features will be non-functional.
- All buttons can be hidden, except settings button. It will be visible with an empty frame if all the three attributes (i.e. userPreferences, exportDocument, print) are hidden.
- If the client desires to remove the whole settings panel, then he has to remove the settings attribute from the JSON input.
- All other icons can be repositioned and reorganized, except right document toolbar, that includes page navigation. It should be on a fixed position.
Description of JSON attributes:
Attribute | Type | Sub Attributes | Release Version | Sub Attribute Type | Default Value | Description |
---|---|---|---|---|---|---|
userInfo | Object | userId | v7.0.307.2 and higher | String | “” | Id of the user. |
userInfo | Object | username | v7.0.307.2 and higher | String | “” | Name of the user. |
leftDocToolbar | Object | hideThumbnails | v7.0.307.2 and higher | Boolean | true | Add/Remove “hide thumbnails” button. |
leftDocToolbar | Object | panning | v7.0.307.2 and higher | Boolean | true | Add/Remove the feature of panning. |
leftDocToolbar | Object | zoom | v7.0.307.2 and higher | Boolean | true | Add/Remove both the features of zoom in and zoom out. |
leftDocToolbar | Object | rotate | v7.0.307.2 and higher | Boolean | true | Add/Remove the rotation button. |
leftDocToolbar | Object | fitToWindow | v7.0.307.2 and higher | Boolean | true | Add/Remove the fit to window view control. |
leftDocToolbar | Object | fitToWidth | v7.0.307.2 and higher | Boolean | true | Add/Remove the fit to width view control. |
leftDocToolbar | Object | actual | v7.0.307.2 and higher | Boolean | true | Add/Remove the actual button. |
leftDocToolbar | Object | rubberbandZoom | v7.0.318.3 | Boolean | true | Add/Remove the rubberband zoom button. |
rightViewerToolbar | Object | uploadDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the upload document feature. |
rightViewerToolbar | Object | viewCheckpoints | v7.0.307.2 and higher | Boolean | true | Add/Remove the feature for viewing checkpoints. |
rightViewerToolbar | Object | insertDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the insert document feature. |
rightViewerToolbar | Object | settings | v7.0.307.2 and higher | Object | ||
rightViewerToolbar | Object | newDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the new document button. |
rightViewerToolbar | Object | scanDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the scan document feature. |
rightViewerToolbar | Object | closeFile | v7.0.307.2 and higher | Boolean | true | Add/Remove the close file button from the tab. |
rightViewerToolbar | Object | closeAllFile | v7.0.307.2 and higher | Boolean | true | Add/Remove the close all file button from the tab. |
rightViewerToolbar | Object | saveDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the save document button. |
rightViewerToolbar | Object | viewComments | v7.0.307.2 and higher | Boolean | true | Add/Remove the feature for viewing comments. |
rightViewerToolbar | Object | docMetadata | v7.0.307.2 and higher | Boolean | true | Add/Remove the document metadata button. |
rightViewerToolbar | Object | attachments | v7.0.307.2 and higher | Boolean | true | Add/Remove the attachments button from the tab. |
rightViewerToolbar | Object | addNotes | v7.0.307.2 and higher | Boolean | true | Add/Remove the add notes button. |
rightViewerToolbar | Object | userPreferences | v7.0.307.2 and higher | Boolean | true | Add/Remove the user preferences button. |
rightViewerToolbar | Object | info | v7.0.307.2 and higher | Boolean | true | Enable/Disable the information button which shows the version number of the application. |
rightDocToolbar | Object | pageNavigation | v7.0.307.2 and higher | Boolean | true | Add/Remove page navigation group of controls, which includes previous page, next page, go to page and total number of pages. |
thumbnailToolbar | Object | popInOut | v7.0.307.2 and higher | Boolean | false | Add/Remove the pop in out button. |
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “View” | Name of the view ribbon toolbar. |
ribbonToolbar | Array of Objects | isViewTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the view tab with all controls. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Insert” | Name of the insert toolbar. |
ribbonToolbar | Array of Objects | isInsertTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the insert tab with all controls. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Annotate” | Name of the annotation toolbar. |
ribbonToolbar | Array of Objects | isAnnotationTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the annotation tab with all facilities. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Redact” | Name of the redaction toolbar. |
ribbonToolbar | Array of Objects | isRedactTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the redact tab with all features. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Signature” | Name of the signature toolbar. |
ribbonToolbar | Array of Objects | isSignatureTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the signature tab with the feature. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Speech” | Name of the speech toolbar. |
ribbonToolbar | Array of Objects | isSpeechTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the speech tab with all the features. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Compare” | Name of the compare toolbar. |
ribbonToolbar | Array of Objects | isCompareTabVisible | v7.0.307.2 and higher | Boolean | true | Add/Remove the compare tab with all the features. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
ribbonToolbar | Array of Objects | name | v7.0.307.2 and higher | String | “Medify” | Name of the medify toolbar. |
ribbonToolbar | Array of Objects | isMedifyTabVisible | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to show the medify tab with all the features whenever an audio or video file is rendered. |
ribbonToolbar | Array of Objects | children | v7.0.307.2 and higher | Object | ||
general | Object | displayAnnIndicator | v7.0.338 | Boolean | true | Set to ‘false’ to hide the annotation indicator shown on the thumbnail page. |
general | Object | view | v7.0.307.2 and higher | String | “pageView” | Defines the view of thumbnail window. The possible values are “pageView” and “docView”. |
general | Object | zoomPreference | v7.0.307.2 and higher | String | “actualControl” | Defines the default zoom value. The possible values are “actualControl”, “fitToWindowControl” and “fitToWidthControl”. |
general | Object | newDocPre | v7.0.307.2 and higher | String | “pdf” | The format type for saving new documents. |
general | Object | switchThumb | v7.0.307.2 and higher | String | “left” | Represents the direction of thumbnail tab. The possible values are “left”, “right”, “top”, and “bottom”. |
general | Object | isLogEnabled | v7.0.307.2 and higher | Boolean | false | To enable or disable the browser console logs. |
general | Object | selectedOption | v7.0.307.2 and higher | String | “info” | The level of logging in browser console. The possible values are “info” and “debug”. |
general | Object | isOcrEnabled | v7.0.307.2 and higher | Boolean | true | Set to ‘false’ to restricts the functionality of searching text in image files. |
general | Object | firstChunkSize | v7.0.307.2 and higher | number | 1 (mb) | Controls the size of first chunk that is downloaded by the viewer. |
general | Object | annComments | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to display the annotation comments window on drawing any annotation. |
general | Object | cacheManagerSize | v7.0.307.2 and higher | number | 25 (mb) | The total memory size of the cache manager. |
general | Object | waitTime | v7.0.307.2 and higher | number | 5 | Wait until the (0.5 seconds) time limit is reached and display the thumbnails without the icon. |
general | Object | showDocThumbBar | v7.0.307.2 and higher | Boolean | true | The document thumbnails will show up as usual. Set to ‘false’ to hide the document thumbnails. |
general | Object | showDocSignPanel | v7.0.307.2 and higher | Boolean | true | The document signature panel will be displayed. Set to ‘false’ to hide the document signature panel. |
general | Object | autogrowDocTabWidth | v7.0.307.2 and higher | Boolean | false | Filename will cut off as usual, by default,. Set to ‘true’ to enable it to auto fit. |
general | Object | embedAnnotationOnStamping | v7.0.307.2 and higher | Boolean | true | Embed annotation into PDF on stamping the document instead of saving in JSON. |
general | Object | enablePDFLockAfterSigning | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to restrict the PDF document from being edited after applying a digital signature. |
general | Object | pdfFlattening | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to restrict the functionality of editing the form fields. |
general | Object | thumbnailZoomControls | v7.0.307.2 and higher | Boolean | true | Add/Remove the thumbnail size toolbar. |
general | Object | redactInJSON | v7.0.307.2 and higher | Boolean | true | To save the redacted file in JSON or set to ‘false’ to directly burn it into the document. |
general | Object | saveOnlyIfModified | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to save only modified document. |
general | Object | blockingSpinnerOnSave | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to enable the blocking spinner on save. |
general | Object | hideInViewerNotifications | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to hide the alert messages in the viewer. |
general | Object | skipSaveCheckOnUnload | v7.0.338 | Boolean | false | Set to ‘true’, to restrict the prompt that appears for any unsaved changes. |
general | Object | enableHyperlinksByRegEx | v7.0.315 | String | * | To enable all the hyperlinks in the documents. |
general | Object | saveAnnotationAsMimeType | v7.0.327 | String | “application/json” | The annotations on the document will be saved in JSON. If it is set to “application/vnd.ibm.modcap”, the annotations will be saved in the MO:DCA binary file. |
docTabPreferences | Object | focusTabStyle | v7.0.307.2 and higher | Object | To style the tab which is in focus. | |
docTabPreferences | Object | tabStyle | v7.0.307.2 and higher | Object | To style the tab which is not in focus. | |
compareDocsPreference | Object | detailPreference | v7.0.307.2 and higher | Object | Provide the details of the comparison result. | |
compareDocsPreference | Object | displayPreference | v7.0.307.2 and higher | Object | To set the preferences for comparison between the two documents. |
Settings for Right Viewer Toolbar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
insertDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the insert document button. |
exportDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the export document button. |
download | v7.0.307.2 and higher | Boolean | true | Add/Remove the download button. |
v7.0.307.2 and higher | Boolean | true | Add/Remove the print button. | |
saveDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the save document button. |
newDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the new document button. |
Children for View Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
split | v7.0.307.2 and higher | Boolean | true | Restricts the use of split function in case of false value. |
undo | v7.0.307.2 and higher | Boolean | true | Add/Remove the undo button. |
invert | v7.0.307.2 and higher | Boolean | true | Add/Remove the invert button. |
copyPgToClipboard | v7.0.307.2 and higher | Boolean | true | Add/Remove the copy to the clipboard button. |
thumbnailView | v7.0.307.2 and higher | Boolean | true | Add/Remove the thumbnail panel. |
sideBysideView | v7.0.307.2 and higher | Boolean | true | Add/Remove the side by side view button from the tab. |
textSearch | v7.0.307.2 and higher | Boolean | true | Add/Remove the text search feature. |
selectText | v7.0.307.2 and higher | Boolean | true | Add/Remove the select text feature. |
Children for Insert Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
cutCopyPaste | v7.0.307.2 and higher | Boolean | true | Add/Remove all three buttons for cut, copy and paste respectively. |
deletePage | v7.0.307.2 and higher | Boolean | true | Add/Remove the delete page functionality. |
checkpoint | v7.0.307.2 and higher | Boolean | true | Add/Remove the checkpoint comments button. |
appendDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the append document button. |
watermark | v7.0.307.2 and higher | Boolean | true | Add/Remove the facility of drawing watermarks. |
snippingTool | v7.0.307.2 and higher | Boolean | true | Add/Remove the snipping tool button. |
trimPage | v7.0.307.2 and higher | Boolean | true | Add/Remove the trim page button. |
Children for Annotate Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
line | v7.0.307.2 and higher | Boolean | true | Add/Remove the line annotation button. |
arrow | v7.0.307.2 and higher | Boolean | true | Add/Remove the arrow annotation button. |
circle | v7.0.307.2 and higher | Boolean | true | Add/Remove the circle annotation button. |
rectangle | v7.0.307.2 and higher | Boolean | true | Add/Remove the rectangle annotation button. |
pen | v7.0.307.2 and higher | Boolean | true | Add/Remove the pen annotation button. |
highlight | v7.0.307.2 and higher | Boolean | true | Add/Remove the highlight annotation button. |
textAnnotation | v7.0.307.2 and higher | Boolean | true | Add/Remove the text annotation button. |
stamp | v7.0.307.2 and higher | Boolean | true | Add/Remove the stamp annotation button. |
polyline | v7.0.307.2 and higher | Boolean | true | Add/Remove the polyline annotation button. |
polygon | v7.0.307.2 and higher | Boolean | true | Add/Remove the polygon annotation button. |
cloud | v7.0.307.2 and higher | Boolean | true | Add/Remove the cloud annotation button. |
stickynote | v7.0.307.2 and higher | Boolean | true | Add/Remove the sticky notes button. |
button | v7.0.307.2 and higher | Boolean | true | Add/Remove the button annotation button. |
showHideAnn | v7.0.307.2 and higher | Boolean | true | Add/Remove the show hide annotation button. |
Children for Redact Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
redactSelectedText | v7.0.307.2 and higher | Boolean | true | Add/Remove the redact selected text button. |
redactWord | v7.0.307.2 and higher | Boolean | true | Add/Remove the redact word button. |
redaction | v7.0.307.2 and higher | Boolean | true | Add/Remove the redaction button. |
searchRedact | v7.0.307.2 and higher | Boolean | true | Add/Remove the search and redact button. |
clearRedaction | v7.0.307.2 and higher | Boolean | true | Add/Remove the option of clear redaction. |
redactPage | v7.0.307.2 and higher | Boolean | true | Add/Remove the redact page button. |
redactViewMode | v7.0.307.2 and higher | Boolean | true | Add/Remove the redact view mode functionality. |
Children for Signature Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
drawSignature | v7.0.307.2 and higher | Boolean | true | Add/Remove the facility of drawing signature button. |
Children for Speech Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
previousPageSpeech | v7.0.307.2 and higher | Boolean | true | Add/Remove the previous page speech button. |
play | v7.0.307.2 and higher | Boolean | true | Add/Remove the play speech button. |
pause | v7.0.307.2 and higher | Boolean | true | Add/Remove the pause speech button. |
stop | v7.0.307.2 and higher | Boolean | true | Add/Remove the stop speech button. |
nextPageSpeech | v7.0.307.2 and higher | Boolean | true | Add/Remove the next page speech button. |
speechSpeed | v7.0.307.2 and higher | Boolean | true | Add/Remove the speech speed button. |
Children for Compare Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
comparedocsView | v7.0.307.2 and higher | Boolean | true | Add/Remove the compare document button. |
startSync | v7.0.307.2 and higher | Boolean | true | Add/Remove the start sync button. |
closeComapreDocuments | v7.0.307.2 and higher | Boolean | true | Add/Remove the close compare documents button. |
comparePanel | v7.0.307.2 and higher | Boolean | true | Add/Remove the compare panel button. |
Children for Medify Toolar
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
addSnapshot | v7.0.307.2 and higher | Boolean | true | Add/Remove the add snapshot button. |
openSnapshotAsNewDocument | v7.0.307.2 and higher | Boolean | true | Add/Remove the open snapshot as new document button. |
enableDisableCommentSubtitle | v7.0.307.2 and higher | Boolean | true | Add/Remove the enable disable comment subtitle button. |
Attributes of Focus Tab Style
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
backgroundColor | v7.0.307.2 and higher | String | “#0853B5” | Represents the background color of the tab. |
color | v7.0.307.2 and higher | String | “#fff” | Represents the color of the font. |
fontWeight | v7.0.307.2 and higher | Number | 400 | To set the font weight for an element that can be set from 100 to 900. (Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold) |
fontStyle | v7.0.307.2 and higher | String | “normal” | To set the style of the font to normal, italic, or underline. |
fileName | v7.0.307.2 and higher | String | “” | Contains the name of the file to be displayed. |
icon | v7.0.307.2 and higher | String | “” | Stores the BASE64 image of the icon to be displayed over the documents tab. |
Attributes of Tab Style
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
backgroundColor | v7.0.307.2 and higher | String | “#f7f7f7” | Represents the background color of the tab. |
color | v7.0.307.2 and higher | String | “#545454” | Represents the color of the font. |
fontWeight | v7.0.307.2 and higher | Number | 400 | To set the font weight for an element that can be set from 100 to 900. (Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold) |
fontStyle | v7.0.307.2 and higher | String | “normal” | To set the style of the font to normal, italic, or underline. |
fileName | v7.0.307.2 and higher | String | “” | Contains the name of the file to be displayed. |
icon | v7.0.307.2 and higher | String | “” | Stores the BASE64 image of the icon to be displayed over the documents tab. |
Attributes of Detail Preference
Attribute | Release Version | Type | Default Value | Description |
---|---|---|---|---|
fullDetail | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to generate full details of comparison result. |
Attributes of Display Preference
Attribute | Release Version | Type | Default Value | Description |
textInfo | v7.0.307.2 and higher | Boolean | true | Set to ‘true’ to generate full details of comparison result. |
imageInfo | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to display the images comparison between the two documents. |
graphicsInfo | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to display the graphics comparison between the two documents. |
annotInfo | v7.0.307.2 and higher | Boolean | false | Set to ‘true’ to display the annotation comparison between the two documents. |
Get User Preferences
getUserPreferences(defaultPrefJSON, defaultShortcutPrefJSON, loadFromAssets)
Summary:
Get user preferences from the user.
Parameters:
- defaultPrefJSON:
- Type: JSON object
- Description: A JSON object to viewer preferences.
- defaultShortcutPrefJSON:
- Type: JSON object
- Description: An object to shortcut preferences. Shortcut preferences object would contain below attributes:
Shortcuts: It is an array of object and every object has three attributes:- Key: It provides shortcut patterns and assigned with respect to the command attribute. Combination of two keys will be separated by ‘+’ sign, so it is obligatory to add ‘+’ sign after every key within the combination.
- Command: It is fixed. It cannot be changed.
- Title: It can be according to the user’s choice.
For Example:
{ "shortcuts": [{"key": "Alt+=", "command": "zoomin", "title":"Zoom In"}] }
Description of shortcut JSON in tabular format:
Key Command Title Alt+= zoomin Zoom In Alt+- zoomout Zoom Out Shift+S save Save Ctrl+Shift+X export Export Shift+P print Print Shift+HOME firstpage First Page Shift+END lastpage Last Page Alt+PAGEUP previouspage Previous Page Alt+PAGEDOWN nextpage Next Page Shift+R rotateclockwise Rotate Ctrl+Alt+B thumbnails Thumbnails Ctrl+Shift+Y redaction Redaction Alt+P search and redact Search And Redact Shift+Z redact view mode Redact View Mode Ctrl+Alt+L line Line Ctrl+Alt+R rectangle Rectangle Ctrl+Alt+C circle Circle Shift+Alt+O arrow Arrow Ctrl+Alt+P pen Pen Shift+Alt+H highlight Highlight Shift+Alt+K text Text Shift+Alt+S stamp Stamp Shift+Alt+M polyline Polyline Shift+Alt+N polygon Polygon Shift+Ctrl+Q checkpoint Checkpoint Ctrl+Alt+W watermark Watermark Ctrl+/ comments Comments Ctrl+M show-hide annotations Show-Hide Annotations DELETE delete annotations Delete Annotations Ctrl+1 actual size Actual Size Ctrl+2 fit to width Fit To Width Ctrl+3 fit to window Fit To Window Ctrl+X cut page Cut Page Ctrl+DELETE delete page Delete Page Ctrl+C copy page Copy Page Ctrl+V paste page Paste Page Ctrl+Shift+F search Search Shift+< previous search Previous Search Shift+> next search Next Search Alt+I version number Version Number Alt+H show keyboard hint Show Hotkeys Hint
- Type: Boolean value
- Description: Set to true if user and annotation preferences are to be served explicitly from assets folder, or else set to false. If this parameter is not provided, then the default value false will be considered.
Returns:
A promise object, which is resolved when the execution finishes, and the preferences are passed as an argument.
Class: WatermarkService
Watermark
newWatermark(properties)
Summary:
Creates a new watermark.
Parameters:
- properties:
- Type: JSON object
- Description: This will have the following attributes as described below:
- stretch
- position
- opacity
- style
- name
- text
The schema of JSON is as follows:
{ "stretch": "100%", "position": "left or center or right", "opacity": "transparent or opaque", "style": "top or center or bottom or diagonal or revdiagonal", "name": "", "text": "sometext { EditBy | Date | Time | PageNumber | TotalPages | DocumentName }" }
Returns:
A promise object, which is resolved when the execution finishes, and the name of the watermark is passed as an argument.
Add Edit Watermark
addEditWatermark(properties)
Summary:
This API will allow user to draw and edit the existing watermark.
Parameters:
- properties:
- Type: Object Type
- Description: This will have the following attributes as described below:
Attribute Name | Type | Description |
id | String | “in case of adding new watermark, in case of editing provide id position” |
text | String | the text user wants to display style. |
style | String | where the text should be displayed. (top, center, bottom, diagonal, revdiagonal) |
position | String | position string from where the text should start. (left, center, right) |
opacity | String | alpha value of the text. (transparent, opaque) |
stretch | String | percentage at which the text should be displayed. (100, 50, 33) |
font | String | font of the text. (Courier, Helvetica, Times-Roman) |
pageOption | String | on which page watermark should be added. (allPages, pageRange[1, 1], currentPage) |
Returns:
Watermark API returns a promise object with the id of the watermark which is resolved on successfully adding a watermark in the viewer.
Delete Watermark
deleteWatermark(watermarkId)
Summary:
This API is used to delete the existing watermark on the page.
Parameters:
- watermarkId:
- Type: String
- Description: Id of the watermark to edit. This is the id of the watermark that we will be getting on the console after drawing a particular watermark.
Returns:
A promise object, which is resolved when the function finishes execution.
Class: AnnotationService
Select Shape
selectShape(annType, options)
Summary:
Select shape for which type of annotation needs to be drawn.
Parameters:
- annType:
- Type: AnnotationType
- Description: Type of the annotation drawing. Possible values would be: “line”, “arrow”, “circle”, “rectangle”, “highlight”, “stamp”, “text”, “stickynote”, “checkpoint”
- options:
- Type: Object type
- Description: An object that includes two attributes: stamp type, i.e. either text stamp or image stamp, and info. We will get the information through Get Stamps API.
{ stampType: "imageStamp" or "textStamp", info: [{mimeType:"png", stampName:"Approved", stampURL:"stampurl"}] }
Returns:
A promise object, which is resolved when the execution finishes.
Get Stamps
getStamps(loadFromAssets)
Summary:
Get stamps API will provide the information about the image stamp to Select Shape API.
Parameters:
- loadFromAssets [optional]:
- Type: Boolean value
- Description: Set to true if predefined stamps are to be served explicitly from assets folder, or else set to false. If this parameter is not provided, then the default value false will be considered.
Returns:
A promise object, which is resolved when the execution finishes, and the array of objects, is passed as an argument to the Select Shape API.
return “[{mimetype: "", stampName:"", stampURL:""},{}]"
Set Custom Stamps
setCustomStamps(customStamps)
Summary:
Set Custom Stamps API is used to set the custom image stamp.
Parameters:
- customStamps:
- Type: Array of objects.
- Description: Array of objects where each object represents an image stamp.
[ { "stampName":"Approved", "mimeType":"png", "stampURL":"data:image/png;base64," } ]
Each image object in the array carries three attributes:
Attribute | Type | Description |
stampName | String | The name of the stamp appears in the stamp list. |
mimeType | String | Type of image stamp. Note: Only PNG image format is currently supported. Hence should be set to “png” |
stampURL | String | It includes BASE64 encoded image data of the stamp. |
Returns:
A promise object, which is resolved when the execution finishes. Boolean true is passed on success and false on failure.
Draw Shapes
drawShapes(pageNo, position, options)
Summary:
Draws the annotation.
Parameters:
- pageNo:
- Type: Number
- Description: Page number starting from 1, of the page on which annotation needs to be drawn.
- position:
- Type: Object type
- Description: It stores the coordinates of the shape (annotation) to be drawn. Object that stores the position of the annotation ‘rectangle’:
- X: Start X position of the annotation.
- Y: Start Y position of the annotation.
- Width: Width of the annotation.
- Height: Height of the annotation.
const position = { X: 10, Y: 10, Width: 100, Height: 100, },
- options[Optional]:
- Type: JSON object
- Description: Object stores annotation properties. This attribute is optional. If not passed default attributes of the annotation will be used. This object currently supports the below attributes and all attributes are optional, all missing attributes will be defaulted to their default values:
- borderWidth:
- Type: Number
- Description: Border width of the annotation in pixel.
- Applies To Annotation Type: Line, Circle, Rectangle, Arrow, Pen, Text, Polyline, Polygon, Cloud
- borderColor:
- Type: String
- Description: Border color of the annotation in pixel. In “RGB(0,0,0)” format.
- Applies To Annotation Type: Line, Circle, Rectangle, Arrow, Pen, Text, Polyline, Polygon, Cloud
- fillColor:
- Type: String
- Description: Fill color of the annotation in pixel. In “RGB(0,0,0)” format.
- Applies To Annotation Type: Circle, Rectangle, Text, Polygon, Cloud
- text:
- Type: String
- Description: Value of Text annotation to be displayed.
- Applies To Annotation Type: Text, Text Stamp
- opacity:
- Type: Number
- Description: Border Opacity of the annotation in range between 0 to 1.
- Applies To Annotation Type: Line, Circle, Rectangle, Arrow, Pen, Text, Polyline, Polygon, Cloud
- fontName:
- Type: String
- Description: Name of font to be used to draw annotation.
- Applies To Annotation Type: Text, Text Stamp
- fontSize:
- Type: Number
- Description: Font size used to draw annotation.
- Applies To Annotation Type: Text, Text Stamp
- image:
- Type: String
- Description: Base64 stream of the image to be used to draw as image stamp.
- Applies To Annotation Type: Image Stamp
{ borderWidth: 0, borderColor: "RGB(0,0,0)", fillColor: "RGB(0,0,0)", text: "", opacity: 0.5, fontName: "Arial", fontSize: 10, image: "BASE64STRING or relative path to image" }
- borderWidth:
Returns:
A promise object, which is resolved when the execution finishes.
Add Link To Annotation
addLinkToAnnotation(annId, options)
Summary:
To add a link to the annotation that points to an existing page within the document or to any URL hyperlink.
Parameters:
- annID:
- Type: String
- Description: The ID of the annotation to link. This is the ID of the annotation that was received via “setAnnCreatedCallback”.
- options:
- Type: Object
- Description:It is an object type with two optional attributes, where either one can be provided. If both are provided, then “URL” will be considered.
- url:
- Type: String
- Description: To link the annotation with the external URL.
- pageNo:
- Type: Number
- Description: To link the annotation with the page number within the document.
- url:
Returns:
A promise object, which is resolved when the execution finishes.
Edit Shape
editShape(docId, annId, pageNo, position, options)
Summary:
It will modify the annotations according to the new position and updated properties.
Parameters:
- docId:
- Type: String value
- Description: The document ID of a document.
Note: Kept for future use currently should be set to null.
- annId:
- Type: String value
- Description: The ID of the annotation to edit. This is the ID of the annotation that was received via “setAnnCreatedCallback” API.
- pageNo:
- Type: String value
- Description: Index of the page starting from 1, of the page on which the annotation exists.
- position:
- Type: Object type
- Description: It stores the coordinates of the shape (annotation) to be drawn. Object that stores the position of the annotation ‘rectangle’:
- X: Start X position of the annotation.
- Y: Start Y position of the annotation.
- Width: Width of the annotation.
- Height: Height of the annotation.
const position = { X: 10, Y: 10, Width: 100, Height: 100, },
- options[Optional]:
- Type: JSON object
- Description: Object stores annotation properties. This attribute is optional. If not passed default attributes of the annotation will be used. This object currently supports below attributes and all attributes are optional, all missing attributes will be defaulted to their default values:
- borderWidth:
- Type: Number
- Description: Border width of the annotation in pixel.
- Applies To Annotation Type: Line, Circle, Rectangle, Arrow, Pen, Text, Polyline, Polygon, Cloud
- borderColor:
- Type: String
- Description: Border color of the annotation in pixel. In “RGB(0,0,0)” format.
- Applies To Annotation Type: Line, Circle, Rectangle, Arrow, Pen, Text, Polyline, Polygon, Cloud
- fillColor:
- Type: String
- Description: Fill color of the annotation in pixel. In “RGB(0,0,0)” format.
- Applies To Annotation Type: Circle, Rectangle, Text, Polygon, Cloud
- text:
- Type: String
- Description: Value of Text annotation to be displayed.
- Applies To Annotation Type: Text, Text Stamp
- opacity:
- Type: Number
- Description: Border Opacity of the annotation in range between 0 to 1.
- Applies To Annotation Type: Line, Circle, Rectangle, Arrow, Pen, Text, Polyline, Polygon, Cloud
- fontName:
- Type: String
- Description: Name of font to be used to draw annotation.
- Applies To Annotation Type: Text, Text Stamp
- fontSize:
- Type: Number
- Description: Font size used to draw annotation.
- Applies To Annotation Type: Text, Text Stamp
- image:
- Type: String
- Description: Base64 stream of the image to be used to draw as image stamp.
- Applies To Annotation Type: Image Stamp
{ borderWidth: 0, borderColor: "RGB(0,0,0)", fillColor: "RGB(0,0,0)", text: "", opacity: 0.5, fontName: "Arial", fontSize: 10, image: "BASE64STRING or relative path to image" }
- borderWidth:
Returns:
A promise object, which is resolved when the execution finishes.
Delete Shape
deleteShape(pageNo, annId)
Summary:
It will delete the annotation with the respective annotation ID.
Parameters:
- pageNo:
- Type: String value
- Description: The page index on which the annotation exists.
- annId:
- Type: String value
- Description: The ID of the corresponding annotation.
Returns:
A promise object, which is resolved when the execution finishes.
Get All Annotations
getAllAnnotations(userName)
Summary:
It will return all the annotations on the document.
Parameters:
- userName [optional]:
- Type: String value
- Description: Show all the annotations for the specific username. In case, there is no username provided, then all the annotations will be returned.
Returns:
A promise object, which is resolved when the execution finishes, and the array of objects, is passed as an argument.
returns " [{annID: "", pgNo: ""},{annID: "", pgNo: ""}]"
Get Annotation Details
getAnnotationDetails(annId)
Summary:
It will provide the details of the respective annotation whose Id is entered as a parameter.
Parameters:
- annId:
- Type: String value
- Description: ID of the annotation.
Returns:
A promise object, which is resolved when the execution finishes, and the array of objects, is passed as an argument.
{ Id: "d7368cc8-bcba-4c05-926c-82f9b5eec8c2" annCreatorName: "a" annType: "Line" borderColor: "#FF0000" borderWidth: "5px" currentDate: "10/26/2021" currentTime: "7:17:30 PM" fillColor: "" fontSize: 0 fontStyle: "" opacity: "1.0" pageNo: 1 stampHeight: 0 stampImageUrl: "" stampWidth: 0 textColor: "" textValue: "" }
Get Filtered Annotations
getFilteredAnnotations(userName, annType, pageNo)
Summary:
It will return the information of annotations with respect to the provided details. In case, none of the parameter values are provided, then it will display the information for all the annotations.
Parameters:
- userName [optional]:
- Type: String value
- Description: Show all the annotations for the specific username. In case, there is no username provided, then all the annotations will be returned.
- annType [optional]:
- Type: String value
- Description: The type of annotation can be: Line, Rectangle, Circle, Arrow, Highlight, Text, Stamp, Stickynote or CheckPoint.
- PageNo [optional]:
- Type: Integer value
- Description: It stores the page number for which the annotation is being returned.
Returns:
A promise object, which is resolved when the execution finishes, and the array of objects, is passed as an argument.
[{ Id:"d7368cc8-bcba-4c05-926c-82f9b5eec8c2" annCreatorName: "a" annType: "Line" borderColor: "#FF0000" borderWidth: "5px" currentDate: "10/26/2021" currentTime: "7:17:30 PM" fillColor: "" fontSize: 0 fontStyle: "" opacity: "1.0" pageNo: 1 stampHeight: 0 stampImageUrl: "" stampWidth: 0 textColor: "" textValue: "" }]
Update Comment or Reply
updateCommentOrReply(annId, textUpdate, replyId)
Summary:
One can add new comment as well as update comment, but reply will only be edited according to the provided reply Id. New reply will not added through this API.
Parameters:
- annId:
- Type: String value
- Description: ID of the annotation.
- textUpdate:
- Type: String value
- Description: The text which needs to be edited.
- replyId:
- Type: String value
- Description: Id of the reply which is required to be updated.
Returns:
A promise object, which is resolved when the execution finishes.
Add Reply
addReply(annId, replyText)
Summary:
Add a reply to the annotation.
Parameters:
- annId:
- Type: String value
- Description: ID of the annotation.
- replyText:
- Type: String value
- Description: It stores the reply text.
Returns:
A promise object, which is resolved when the execution finishes.
Get Reply by User
getReplyByUser(annId)
Summary:
It takes annotation id as a parameter and checks if the current user has any reply or not. If there is no reply added by the current user, then he has to add a reply or it will return all the replies based on the user who has created the annotation.
Parameters:
- annId:
- Type: String value
- Description: ID of the annotation.
Returns:
A promise object, which is resolved when the execution finishes.
Get All Replies
getAllReplies(annId)
Summary:
Return all replies of an annotation.
Parameters:
- annId:
- Type: String value
- Description: ID of the annotation.
Returns:
A promise object, which is resolved when the execution finishes, and all replies are passed as an argument.
[{ "id":"a553c55d", "userName":"", "time":"10/26/2021 7:45:34 PM", "message":"reply" }, { "id":"80056aca", "userName":"", "time":"10/26/2021 7:46:14 PM", "message":"reply1" }]
Remove Reply
removeReply(replyId, annId)
Summary:
Removes the reply according to the respective reply id and annotation id. Current user can remove his reply, but not any other reply.
Parameters:
- replyId:
- Type: String value
- Description: Id of the reply which is required to be removed.
- annId:
- Type: String value
- Description: ID of the annotation.
Returns:
A promise object, which is resolved when the execution finishes.
Remove All Replies
removeAllReply(annId)
Summary:
Remove all replies for a particular annotation id. Current user can remove all his replies, but not any other reply.
Parameters:
- annId:
- Type: String value
- Description: ID of the annotation.
Returns:
A promise object, which is resolved when the execution finishes.
Class: RedactionService
Draw Redaction
drawRedaction(pageRange, position, options)
Summary:
Redact certain area of the document by drawing redactions.
Parameters:
- pageRange:
- Type: Array of Numbers
- Description: An array of page numbers where redaction needs to be performed.
- position:
- Type: Object
- Description: It contains the following attributes that describes the position of the redaction on the document.
- X:
- Type: Number
- Description: Stores the value of the x coordinate.
- Y:
- Type: Number
- Description: Stores the value of the y coordinate.
- width:
- Type: Number
- Description: Stores the width of the redaction.
- height:
- Type: Number
- Description: Stores the height of the redaction.
- X:
- options:
- Type: Object
- Description: An object type with the following attributes:
- opacity:
- Type: Number
- Description: The default opacity level for redaction before finalizing.
- fillColor:
- Type: String representing the hexadecimal value of a color, starting with #
- Description: The color of the drawn redaction.
- redactionTag:
- Type: String
- Description: The predefined redaction reason tags describe the purpose of the redaction. Here is the set of predefined Redaction Tags :
- Confidential
- Prohibited
- Sensitive
- Important
- Restricted
- SSN
- Account Detail
- opacity:
Returns:
A promise object, which is resolved when the execution finishes.
Redact Word
redactWord(redactWord, options)
Summary:
To redact specific words.
Parameters:
- redactWord:
- Type: String
- Description: Redacts the specific words.
- options:
- Type: Object
- Description: An object type with the following attributes:
- wholeWorld:
- Type: Boolean Value
- Description: Set the value ‘true’ to match and redact the whole word.
- caseSensitive:
- Type: Boolean Value
- Description: Set the value ‘true’ to perform a case sensitive match.
- selectedTag:
- Type: String
- Description: Select the predefined Redaction Tags that describe the purpose of the redaction.
- wholeWorld:
Returns:
A promise object, which is resolved when the execution finishes.
Clear Redaction
clearRedaction(pageRange)
Summary:
Remove all unsaved redactions from the document.
Parameters:
- pageRange:
- Type: Array of Numbers
- Description: An array of page numbers where redactions need to be removed.
Returns:
A promise object, which is resolved when the execution finishes.
Redact Expressions
redactExpressions(expressions, selectedTag)
Summary:
Applies redaction on selected predefined redaction data categories.
Parameters:
- expressions:
- Type: String
- Description: A comma-separated string of smart redaction expressions that need to be searched. There is a set of predefined expressions:
- NAME
- DATE OF BIRTH
- ADDRESS
- CREDIT CARD
- AGE
- ACCOUNT NUMBER
- BETWEEN
- DRIVER LICENSE
- DATE
- EMAIL ADDRESS
- GENDER IDENTITY
- WEB ADDRESS
- PASSPORT NUMBER
- POLICY NUMBER
- PHONE NUMBER
- SOCIAL SECURITY NUMBER
- STATE
- ZIP CODE
- ETHNIC GROUP
- CURRENCY
- selectedTag:
- Type: String
- Description: The predefined Redaction Tags describe the purpose of the redaction.
Returns:
A promise object, which is resolved when the execution finishes.
Get Details
getDetails(pageRange)
Summary:
To get the existing redactions details.
Parameters:
- pageRange:
- Type: Array of Numbers
- Description: An array of page numbers to get the redaction details.
Returns:
A promise object, which is resolved when the execution finishes and returns a Redaction Detail Response Object
Redaction Detail Response Object
It is an object type having following attributes:
- RedactionDetailResponse
- Type: Array
- Description: The array of all redactions is grouped by pages. Hence every index of array contains two attributes, “pageno” & “Redaction Detail Array”.
- pageno:
- Type:
- Description:
- redactionDetail:
- Type: Array
- Description: The array of Redaction Detail Object’s. The Redaction Detail Object contains two attributes:
- redactionID:
- Type: String
- Description: ID of the redaction.
- redactionTag:
- Type: String
- Description: The predefined Redaction Tags describe the purpose of the redaction.
- redactionID:
- pageno:
- docID:
- Type: String
- Description: ID of the document.
Switch Redact View Mode
switchRedactViewMode()
Summary:
Switches the document redaction view mode from redacted to unredacted and vice-versa, based on the users permission level. A Super user has editing privileges for all redactions in the document, while a normal user can only edit their own redactions.
Parameters:
No parameters.
Returns:
A promise object, which is resolved when the execution finishes.
Class: IconCacheManagerService
Invalidate Thumbnail Icon For Pages
invalidateThumbnailIconForPages(options)
Summary:
Removes the icon of page/pages from the viewer’s icon cache. The thumbnails in view will be immediately updated (so the icons are cleared from the UI and the cache) while for others cache will be cleared.
Parameters:
- options:
- Type: Array of objects, with every object carrying the below attributes:
- docId:
- Type: String
- Description: ID of the document.
- pgNo:
- Type: Number
- Description: The page number of the thumbnail.
- vLocation: “TOP | CENTER | BOTTOM” [OPTIONAL]
- Type: String
- Description: The vertical location of the indicator from top to either center or bottom. If not provided icon from all locations will be cleared.
- hLocation: “LEFT | RIGHT | CENTER” [OPTIONAL]
- Type: String
- Description: The horizontal location of the indicator from left to either right or center. If not provided icon from all locations will be cleared.
For Example:
[{ docID: "ID of the document" pgNo: 1 vLocation: "TOP | CENTER | BOTTOM", hLocation: "LEFT | RIGHT | CENTER", }]
- docId:
- Type: Array of objects, with every object carrying the below attributes:
- Description: An array of objects providing information to the pages to be invalidated.
Returns:
A Promise which will be resolved when the API finishes execution.
Get Cache Info
getCacheInfo()
Summary:
Provides information regarding the current icon cache usage which includes total cache memory used, total cache memory remaining, and details on the amount of cache used by each document.
Returns:
A Promise which when resolved will provide the icon cache information object. Memory information is in megabytes.
The object returned will have the following attributes:
- memoryUsed:
- Type: Number
- Description: Total cache memory consumed in mb.
- memoryAvailable:
- Type: Number
- Description: Remaining memory in the cache in mb.
- details:
- Type: Array of objects where each object has two attributes:
- docId:
- Type: String
- Description: ID of the document.
- cacheEntries:
- Type: Number
- Description: Storage count of icons for that document.
- docId:
{ memoryUsed: 3 memoryAvailable: 17 details: [{ docId: "ID of document", cacheEntries: 0 }] }
- Type: Array of objects where each object has two attributes:
Class: SigantureService
Set Available Certificates
setAvailableCertificates(certificates)
Summary:
Provide existing certificates available to the user.
[{ certificate: "BASE64 CERTIFICATE", commonName: "", expiry: "", issuedBy: "", password: "" }]
Set Available Appearances
setAvailableAppearances(appearances)
Summary:
Provide existing signature appearances for the user.
[ "BASE64 IMAGE" ]
Class: DocMetadataService
Set Metadata
setMetadata(data)
Summary:
Assign metadata of the document for the viewer to present it to the user for view edit or update.
Parameter:
- data
- Type: Array of attribute objects.
For more, refer to the details of the attribute object:- id:
- Type: String
- Description: ID of the document.
- title:
- Type: String
- Description: Name of an attribute.
- value:
- Type: String, number, array of objects.
- Description: It contains the value of the attribute that depends upon the type of attribute.
- type:
- Type:string, number, boolean, date, time, date&time, singleChoice, multipleChoices.
Note: The value of the type will be any of them. - Description: It defines the type of data to be stored in the value attribute.
- Type:string, number, boolean, date, time, date&time, singleChoice, multipleChoices.
- constraints:
- Type: Object
- Description: It is an object type that contains below attributes:
- maxLength:
- Type: Number
- Description: It defines the maximum length of the value.
- minLength:
- Type: Number
- Description: It defines the minimum length of the value.
- regularExpression:
- Type: String
- Description: Adds restriction to the value using javascript regular expressions.
- isRequired:
- Type: Boolean Value
- Description: Set to true if the value of the field is mandatory. Set false if optional.
- formatDescription:
- Type: String
- Description: Shows the information message for the field.
- customValidationError:
- Type: String
- Description: Shows the error message for the field after the error occurred.
- readOnly:
- Type: Boolean Value
- Description: Set to true to make the fields in read-only mode.
- maxLength:
- id:
- Type: Array of attribute objects.
Returns: A promise object, which is resolved when the execution finishes.
Get Metadata
getMetadata()
Summary:
Returns all the information for the document metadata.
Parameter: No Parameters
Returns: A promise object, which is resolved when the execution finishes and returns an array of attribute objects.
Event callback APIs for JavaScript integration
[Deprecated] (Refer to new Callback API Service)
These event callback APIs for javascript integration are defined in ‘customevents.js’.
Document Load Complete
_docLoadComplete(docID) {
Summary:
This will be triggered after the loading of the document in the viewer.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
Document Save Complete
_docSaveComplete(docID, response) {
Summary:
This will be triggered after the saving of the document.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- response:
- Type: JSON object
- Description: It stores the JSON object that includes four attributes:
- filePath:
- Type: String
- Description: An absolute path of the saved document on the server. Note: Only available if the document is relayed to the eViewer server after saving.
- jsonPath:
- Type: String
- Description: An absolute path of the saved annotation JSON file on the server. Note: Only available if the document is relayed to the eViewer server after saving.
- documentData:
- Type: String
- Description: BASE64 encoded data of the saved document.
- annotationData:
- Type: String
- Description: Saved annotation JSON data.
- filePath:
{ filePath: "c:/evCache/91C85B31-79F8-41CB-BBFF-AF8E909FA6DA.pdf", jsonPath: "c:/evCache/91C85B31-79F8-41CB-BBFF-AF8E909FA6DA.json", documentData: "", annotationData: "", }
Document Dropped
_docDropped(docID) {
Summary:
This will be triggered when the document is closed or deleted.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
Annotation Created
_annCreated(docID, pageNo, annID) {
Summary:
This will be triggered when the annotation is created.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annID:
- Type: String value
- Description: It stores the ID of the annotation.
Annotation Deleted
_annDeleted(docID, pageNo, annID) {
Summary:
This will be triggered when the annotation is deleted.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annID:
- Type: String value
- Description: It stores the ID of the annotation.
Annotation Property Updated
_annPropUpdated(docID, pageNo, annID, annProperty) {
Summary:
This will be triggered when the property of annotation gets updated.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annID:
- Type: String value
- Description: It stores the ID of the annotation.
- annProperty:
- Type: JSON object
- Description: It stores the JSON object as per the annotation schema definition.
{ "properties": { "COLOR":"255,0,0", "id":"4117c51c-edd8-4bc1-8ac6-261d7fbbc272", "PAGE":1, "BORDER": 5, "origAnnCordinate":1, "WIDTH":76, "X":510, "isTransparent": false, "Y":45, "TRANSPARENT":1, "LINEWIDTH":5, "HEIGHT":63, "PAGESIZE":"3417,4422" } }
Button Annotation Clicked
_buttonAnnClicked(docID, pageNo, annID, buttonText) {
Summary:
This will be triggered when the button annotation is clicked.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annID:
- Type: String value
- Description: It stores the ID of the annotation.
- buttonText:
- Type: String value.
- Description: It stores the text on the button.
Page Changed
_pageChanged(docID, pageNo) {
Summary:
This will be triggered when the page is modified.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being changed.
Page Deleted
_pageDeleted(docID, pageNo) {
Summary:
This will be triggered when the page is deleted.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is deleted.
Page Cut
_pageCut(docID, pageNo) {
Summary:
This will be triggered when the page is cut.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being cut.
Page Copied
_pageCopied(docID, pageNo) {
Summary:
This will be triggered when the page is copied.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being copied on the clipboard.
Page Pasted
_pagePasted(docID, pageNo) {
Summary:
This will be triggered when the page is pasted.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being pasted from the clipboard.
Page Invert
_pageInvert(docID, pageNo) {
Summary:
This event is triggered by the viewer whenever a page in a document is inverted. The ID of the document along with the page number is passed as a result.
Parameters:
- docID:
- Type: String
- Description: ID of the document.
- pageNo:
- Type: Number
- Description: Page number being inverted.
Document Exported
_docExported(docID, selectionOption) {
Summary:
This will be triggered when the document is exported.
Parameters:
- docID:
- Type: String value
- Description: It stores the ID of the document.
- selectionOption:
- Type: String value
- Description: It contains the option selected by user. For example: all documents or customized or current document.
Document Split
_docSplit(baseDocID, splitDocID) {
Summary:
This event is triggered by the viewer whenever a document is split. The ID of the new document generated as a result of the split is passed as a parameter.
Parameters:
- baseDocID:
- Type: String
- Description: ID of the base document where the split is initiated.
- splitDocID:
- Type: String
- Description: ID of the new document generated as a result of split.
Document Redact
_docRedact(docID) {
Summary:
This event is triggered by the viewer whenever a document is redacted. The ID of the document is passed as a result.
Parameters:
- docID:
- Type: String
- Description: ID of the document.
Text Selected
window._textSelected = function (response) {
Summary:
This API is invoked whenever a user selects text.
Parameters:
- response:
- Type: JSON Object.
- Description: It holds the below attributes:
{ "eventType": "TEXT_SELECTED", "coordinates": [ { "x1": 74.001, "y1": 191.70925, "x2": 525.1001692, "y2": 191.70925, "x3": 525.1001692, "y3": 178.24969, "x4": 74.001, "y4": 178.24969 }, { "x1": 54.015, "y1": 205.82624999999985, "x2": 130.12680450000002, "y2": 205.82624999999985, "x3": 192.68534499999998, "y3": 192.68534499999998, "x4": 54.015, "y4": 192.68534499999998, } ], "text": "First line \n Second line text.", "page": 2, "screenInfo": { "width": 1024, "height": 2048 }, "pageInfo": { "width": 1024, "height": 2048 } "pageRotation": 0, }
New Certificate
_newCertificate = function (certificate) {
Summary:
This API is invoked whenever a user imports or loads a new certificate.
Parameters:
- certificate:
- Type: Object type
- Description: It stores the details of the digital signature certificate.
Update Default Certificate
_updateDefaultCertificate = function (certificate) {
Summary:
This API is invoked whenever a user makes a certificate as default.
Parameters:
- certificate:
- Type: Object
- Description: It stores the details of the digital signature certificate that is being made the default and the certificate that was previously the default certificate.
For Example :
{ newDefaultCertificate: newDefaultCert, oldDefaultCertificate: oldDefaultCert }
New Appearance
_newAppearance = function (appearance) {
Summary:
This API is invoked whenever a user creates new appearance for the certificate.
Parameters:
- appearance:
- Type: BASE64 image
- Description: A base64 image of the signature that user has created.
Preference Update
_preferenceUpdate = function (preferenceData) {
Summary:
This will be triggered whenever the user preferences are updated from the preference dialog.
Parameters:
- preferenceData:
- Type: Object type
- Description: It holds the below attributes:
{ "userName": "", "userPreference": {}, "annotationPreference": {}, "customStamps": {} }
Zoom Change
_zoomChange = function (zoomData) {
Summary:
This will be triggered when the zoom value is modified.
Parameters:
- zoomData:
- Type: Object type
- Description: It holds the below attributes:
{ "clientDocID": "", "docID": "", "scale": 1, "zoomPreset": "fitToWidth or fitToWindow" }
Note: Scale is not a number type. It defines ‘1’ as 100%, ‘.5’ as 50% and so on.
On Context Menu
_onContextMenu = function(info){
Summary:
This event is invoked whenever a right click is occurred for context menu and if the overrideContextMenus is set to true for the provided location(s).
Parameters:
- info:
- Type: Object type
- Description: It holds the below attributes:
- location:
- Type: String
- Description: The location of the right click menu. Its value can be “documentView”, “pageThumbnails”, “docThumbnails”, “toolbar” or “docTab”.
- docInfo:
- Type: JSON Object
- Description: The information of document where the context menu right click is done. It includes four attributes:
- docID:
- Type: String
- Description: Viewer assigned document ID.
- clientDocID:
- Type: String
- Description: ID of the document as specified while loading the document.
- fileName::
- Type: String
- Description: Name of the file.
- currentPageNo:
- Type: Number
- Description: Currently viewing page number in the document viewing area.
- docID:
- eventInfo:
- Type: JSON Object
- Description: The information of the event when the context menu right click is done. It includes some attributes:
- pageInfo:
- Type: JSON Object
- Description: Page information will be used for the basis of the coordinates. It has four attributes:
- pageNo:
- Type: Number
- Description: Page number on the which the right click is performed.
- rotation:
- Type: Number
- Description: There are certain values which will define the rotation angle of the page.
Rotation Angle 0 90 180 270 According to the page rotation, the value of x and y coordinates will be fixed. If the page is 90 degree rotated, then the values of x and y coordinates will be different from the values in the normal view.
- width:
- Type: Number
- Description: Stores the width of page.
- height:
- Type: Number
- Description: Stores the height of page.
- pageNo:
- screenInfo:
- Type: JSON Object
- Description: Holds the information of device screen size. It consists of two values:
- width:
- Type: Number
- Description: Stores the width of screen.
- height:
- Type: Number
- Description: Stores the height of screen.
- width:
- viewportCords:
- Type: JSON Object
- Description: The values will be according to the eViewer’s viewport. This object has two attributes:
- x:
- Type: Number
- Description: Value of x coordinate.
- y:
- Type: Number
- Description: Value of y coordinate.
- x:
- pageCords:
- Type: JSON Object
- Description: Currently viewing viewport of the page in the document viewing area.
- x:
- Type: Number
- Description: Value of x coordinate.
- y:
- Type: Number
- Description: Value of y coordinate.
- x:
- pageHasAnnotataions:
- Type: Boolean
- Description: Specifies that the page contains annotation(s) or not.
- annotationInfo:
- Type: Array of Objects
- Description: In case, the value of pageHasAnnotations is “true”, and then annotationInfo contains the array of objects and each object includes two attributes:
- annId:
- Type: String
- Description: Contains Id of all annotation(s) drawn on this particular page.
- zIndex:
- Type: String
- Description: Contains z-index of all annotation(s) drawn on this particular page. The recent annotation z-index will be highlighted or selected.
- annId:
- textInfo:
- Type: JSON Object
- Description: Holds the information about text and the location of the context menu right click. It has three attributes:
- spanText:
- Type: String
- Description: Specific span text on which the right click is done.
- spanX:
- Type: Number
- Description: Value of span left with respect to the viewport of the page.
- spanY:
- Type: Number
- Description: Value of span top with respect to the viewport of the page.
- spanText:
- clickEventInfo:
- Type: JSON Object
- Description: It is the event object captured from browsers right click event.
info: { "location": "documentView" "docInfo": { "docID": "", "clientDocID": "", "fileName": "", currentPageNo: 2 }, "eventInfo": { "pageInfo": { "pageNo":1, "rotation":90, "width":100, "height":100 }, "screenInfo": { "width":100, "height":100 }, "viewportCords": { "x":1, "y":1 }, "pageCords": { "x":1, "y":1 }, "pageHasAnnotations": false, "annotationInfo": [{ annID:"", zIndex:"" }], "textInfo": { "spanText":"", "spanX": 0, "spanY": 0 } "clickEventInfo": { } } }
- pageInfo:
- location:
Tab Switch
_tabSwitch(outFocusViewerDocID, inFocusViewerDocID)
Summary:
This API will be invoked whenever the tab switching is completed. The document Id’s for out/in focus documents will be pushed.
Parameters:
- outFocusViewerDocID:
- Type: String
- Description: ID of the document getting out of focus.
- inFocusViewerDocID:
- Type: String
- Description: ID of the document getting in focus.
Class: CallbackAPIService
Set Page Changed
setPageChangedCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever the page is modified.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setPageChangedCallBack((docID, pageNo) => { console.log("pageChanged " + docID + " " + " current pageNo " + pageNo); });
The callback method has two parameters:
(docId, pageNo) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being changed.
Set Doc Load Complete
setDocLoadCompleteCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever document completely loads.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setDocLoadCompleteCallBack((docID) => { console.log("docLoadComplete Info Below: "); console.log(docInfo); });
The callback method has one parameter:
(docId) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
Set First Page Rendered
setFirstPageRenderedCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever the first page of the document is rendered.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setFirstPageRenderedCallBack((docID, time) => { console.log( "firstPageRendered for documentID: " + docID + " in " + time + "ms" ); });
The callback method has two parameters:
(docId, time) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- time:
- Type: String value
- Description: Time taken to render the first page of the document. (in milliseconds)
Set Doc Save Complete
setDocSaveCompleteCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever document completely saved.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setDocSaveCompleteCallBack((docID, response) => { console.log("docSaveComplete: " + docID + " response: " + response); });
The callback method has two parameters:
(docId, response) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- response:
- Type: JSON Object
- Description: It stores the JSON object that includes four attributes:
- filePath:
- Type: String
- Description: An absolute path of the saved document on the server. Note: Only available if the document is relayed to the eViewer server after saving.
- jsonPath:
- Type: String
- Description: An absolute path of the saved annotation JSON file on the server. Note: Only available if the document is relayed to the eViewer server after saving.
- documentData:
- Type: String
- Description: BASE64 encoded data of the saved document.
- annotationData:
- Type: String
- Description: Saved annotation JSON data.
- filePath:
{ filePath: "c:/evCache/91C85B31-79F8-41CB-BBFF-AF8E909FA6DA.pdf", jsonPath: "c:/evCache/91C85B31-79F8-41CB-BBFF-AF8E909FA6DA.json", documentData: "", annotationData: "", }
Set Doc Split
setDocSplitCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever a document is split. The ID of the new document generated as a result of the split is passed as a parameter.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setDocSplitCallBack((baseDocID, splitDocID) => { console.log("baseDocID: " + baseDocID + " splitDocID: " + splitDocID); let requireDataInResponse = true; this.eViewerObj.getDocumentService().saveDocuments([baseDocID, splitDocID], requireDataInResponse).then((reposne) => { console.log(response); }); });
The callback method has two parameters:
(baseDocId, splitDocID) => {}
- baseDocId:
- Type: String value
- Description: ID of the base document where the split is initiated.
- splitDocID
- Type: String value
- Description: ID of the new document generated as a result of split.
Set Doc Dropped
setDocDroppedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the document is closed or deleted.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setDocDroppedCallBack((docID) => { console.log("docDropped: " + docID); });
The callback method has one parameter:
(docId) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
Set Ann Created
setAnnCreatedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the annotation is created.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setAnnCreatedCallBack((docID, annID, pageNo) => { console.log( "annCreated: docID " + docID + " annID: " + annID + " pageNo: " + pageNo ); });
The callback method has three parameters:
(docId, pageNo, annId) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annId:
- Type: String value
- Description: It stores the ID of the annotation.
Set Ann Deleted
setAnnDeletedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the annotation is deleted.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setAnnDeletedCallBack((docID, annID, pageNo) => { console.log( "annDeleted: docID " + docID + " annID: " + annID + " pageNo: " + pageNo ); });
The callback method has three parameters:
(docId, pageNo, annId) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annId:
- Type: String value
- Description: It stores the ID of the annotation.
Set Ann Prop Updated
setAnnPropUpdatedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the property of annotation gets updated.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setAnnPropUpdatedCallBack( (docID, pageNo, annID, annProperty) => { console.log( "annPropUpdated: docID " + docID + " annID: " + annID + " annProperty: " + annProperty ); } );
The callback method has four parameters:
(docId, pageNo, annId, annProperty) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annId:
- Type: String value
- Description: It stores the ID of the annotation.
- annProperty:
- Type: JSON object
- Description: It stores the JSON object as per the annotation schema definition.
{ "properties": { "COLOR":"255,0,0", "id":"4117c51c-edd8-4bc1-8ac6-261d7fbbc272", "PAGE":1, "BORDER": 5, "origAnnCordinate":1, "WIDTH":76, "X":510, "isTransparent": false, "Y":45, "TRANSPARENT":1, "LINEWIDTH":5, "HEIGHT":63, "PAGESIZE":"3417,4422" } }
Set Wm Prop Updated
setWmPropUpdatedCallBack(callback)
Summary:
The developer can pass the function object which will be invoked when the property of watermark gets updated.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setWmPropUpdatedCallBack((docId, wmId) => { console.log("wmPropUpdated: docID " + docId + " wmID: " + wmId); });
The callback method has two parameters:
(docId, wmId) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- wmId:
- Type: Integer value
- Description: It stores the unique ID of the watermark.
Set Button Ann Clicked
setButtonAnnClickedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the button annotation is clicked.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setButtonAnnClickedCallBack( (docID, annID, pageNo, buttonText) => { console.log( "buttonAnnClicked: docID " + docID + " annID: " + annID + " pageNo: " + pageNo + " buttonText: " + buttonText ); } );
The callback method has four parameters:
(docId, pageNo, annId, buttonText) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number on which the annotation is drawn.
- annId:
- Type: String value
- Description: It stores the ID of the annotation.
- buttonText:
- Type: JSON object
- Description: It stores the text on the button.
Set Doc Exported
setDocExportedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the document is exported.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setDocExportedCallBack((docID, selectionOption) => { console.log( "docExported: " + docID + " selectedOption: " + selectedOption );
The callback method has two parameters:
(docId, selectionOption) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- selectionOption::
- Type: String value
- Description: It contains the option selected by user. For example: all documents or customized or current document.
Set Page Deleted
setPageDeletedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the page is deleted.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setPageDeletedCallBack((docID, pageNo) => { console.log("pageDeleted: " + docID + " current pageNo: " + pageNo); });
The callback method has two parameters:
(docId, pageNo) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is deleted.
Set Page Cut
setPageCutCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the page is cut.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setPageCutCallBack((docID, pageNo) => { console.log("pageCut: " + docID + " currnet pageNo: " + pageNo); });
The callback method has two parameters:
(docId, pageNo) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being cut.
Set Page Copied
setPageCopiedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the page is copied.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setPageCopiedCallBack((docID, pageNo) => { console.log("pageCopied: " + docID + " current pageNo: " + pageNo); });
The callback method has two parameters:
(docId, pageNo) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being copied on the clipboard.
Set Page Pasted
setPagePastedCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the page is pasted.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setPagePastedCallBack((docID, pageNo) => { console.log("pagePasted: " + docID + " current pageNo: " + pageNo); });
The callback method has two parameters:
(docId, pageNo) => {}
- docId:
- Type: String value
- Description: It stores the ID of the document.
- pageNo:
- Type: Integer value
- Description: It stores the page number which is being pasted from the clipboard.
Set Text Selected
setTextSelectedCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever a user selects text.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setTextSelectedCallBack((response) => { console.log(response); });
The callback method has one parameter:
(response) => {}
- response:
- Type: JSON Object
- Description: It holds the below attributes:
{ "eventType": "TEXT_SELECTED", "coordinates": [ { "x1": 74.001, "y1": 191.70925, "x2": 525.1001692, "y2": 191.70925, "x3": 525.1001692, "y3": 178.24969, "x4": 74.001, "y4": 178.24969 }, { "x1": 54.015, "y1": 205.82624999999985, "x2": 130.12680450000002, "y2": 205.82624999999985, "x3": 192.68534499999998, "y3": 192.68534499999998, "x4": 54.015, "y4": 192.68534499999998, } ], "text": "First line \n Second line text.", "page": 2, "screenInfo": { "width": 1024, "height": 2048 }, "pageInfo": { "width": 1024, "height": 2048 } "pageRotation": 0, }
Set New Certificate
setNewCertificateCallback(callback)
Summary:
The developer can pass the function object which will be invoked when a user imports or loads a new certificate.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setNewCertificateCallBack((certificate) => { console.log(certificate); });
The callback method has one parameter:
(certificate) => {}
- certificate:
- Type: Object type
- Description: It stores the details of the digital signature certificate.
Set Update Default Certificate
setUpdateDefaultCertificateCallback(callback)
Summary:
The developer can pass the function object which will be invoked when a user makes a certificate as default.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setUpdateDefaultCertificateCallBack( (certificate) => { console.log(certificate); } );
The callback method has one parameter:
(certificate) => {}
- certificate:
- Type: Object
- Description: It stores the details of the digital signature certificate that is being made the default and the certificate that was previously the default certificate.
For Example:
{ newDefaultCertificate: newDefaultCert, oldDefaultCertificate: oldDefaultCert }
Set New Appearance
setNewAppearanceCallback(callback)
Summary:
The developer can pass the function object which will be invoked when a user creates new appearance for the certificate.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setNewAppearanceCallBack((appearance) => { console.log(appearance); });
The callback method has one parameter:
(appearance) => {}
- appearance:
- Type: BASE64 image
- Description: A base64 image of the signature that user has created.
Set Preference Update
setPreferenceUpdateCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever the user preferences are updated from the preference dialog.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setPreferenceUpdateCallBack((preferenceData) => { console.log(preferenceData); });
The callback method has one parameter:
(preferenceData) => {}
- preferenceData:
- Type: Object type
- Description: It holds the below attributes:
{ "userName": "", "userPreference": {}, "annotationPreference": {}, "customStamps": {} }
Set Zoom Change
setZoomChangeCallback(callback)
Summary:
The developer can pass the function object which will be invoked when the zoom value is modified. This will be triggered when the zoom value is modified.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setZoomChangeCallBack((zoomData) => { console.log(zoomData); });
The callback method has one parameter:
(zoomData) => {}
- zoomData:
- Type: Object type
- Description: It holds the below attributes:
{ "clientDocID": "", "docID": "", "scale": 1, "zoomPreset": "fitToWidth or fitToWindow" }
Note: Scale is not a number type. It defines ‘1’ as 100%, ‘.5’ as 50% and so on.
Set On Context Menu
setOnContextMenuCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever a right click is occurred for context menu and if the overrideContextMenus is set to true for the provided location(s).
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setOnContextMenuCallBack((info) => { console.log(info); });
The callback method has one parameter:
(info) => {}
- info:
- Type: Object type
- Description: It holds the below attributes:
- location:
- Type: String
- Description: The location of the right click menu. Its value can be “documentView”, “pageThumbnails”, “docThumbnails”, “toolbar” or “docTab”.
- docInfo:
- Type: JSON Object
- Description: The information of document where the context menu right click is done. It includes four attributes:
- docID:
- Type: String
- Description: Viewer assigned document ID.
- clientDocID:
- Type: String
- Description: ID of the document as specified while loading the document.
- fileName::
- Type: String
- Description: Name of the file.
- currentPageNo:
- Type: Number
- Description: Currently viewing page number in the document viewing area.
- docID:
- eventInfo:
- Type: JSON Object
- Description: The information of the event when the context menu right click is done. It includes some attributes:
- pageInfo:
- Type: JSON Object
- Description: Page information will be used for the basis of the coordinates. It has four attributes:
- pageNo:
- Type: Number
- Description: Page number on the which the right click is performed.
- rotation:
- Type: Number
- Description: There are certain values which will define the rotation angle of the page.
Rotation Angle 0 90 180 270 According to the page rotation, the value of x and y coordinates will be fixed. If the page is 90 degree rotated, then the values of x and y coordinates will be different from the values in the normal view.
- width:
- Type: Number
- Description: Stores the width of page.
- height:
- Type: Number
- Description: Stores the height of page.
- pageNo:
- screenInfo:
- Type: JSON Object
- Description: Holds the information of device screen size. It consists of two values:
- width:
- Type: Number
- Description: Stores the width of screen.
- height:
- Type: Number
- Description: Stores the height of screen.
- width:
- viewportCords:
- Type: JSON Object
- Description: The values will be according to the eViewer’s viewport. This object has two attributes:
- x:
- Type: Number
- Description: Value of x coordinate.
- y:
- Type: Number
- Description: Value of y coordinate.
- x:
- pageCords:
- Type: JSON Object
- Description: Currently viewing viewport of the page in the document viewing area.
- x:
- Type: Number
- Description: Value of x coordinate.
- y:
- Type: Number
- Description: Value of y coordinate.
- x:
- pageHasAnnotataions:
- Type: Boolean
- Description: Specifies that the page contains annotation(s) or not.
- annotationInfo:
- Type: Array of Objects
- Description: In case, the value of pageHasAnnotations is “true”, and then annotationInfo contains the array of objects and each object includes two attributes:
- annId:
- Type: String
- Description: Contains Id of all annotation(s) drawn on this particular page.
- zIndex:
- Type: String
- Description: Contains z-index of all annotation(s) drawn on this particular page. The recent annotation z-index will be highlighted or selected.
- annId:
- textInfo:
- Type: JSON Object
- Description: Holds the information about text and the location of the context menu right click. It has three attributes:
- spanText:
- Type: String
- Description: Specific span text on which the right click is done.
- spanX:
- Type: Number
- Description: Value of span left with respect to the viewport of the page.
- spanY:
- Type: Number
- Description: Value of span top with respect to the viewport of the page.
- spanText:
- clickEventInfo:
- Type: JSON Object
- Description: It is the event object captured from browsers right click event.
- pageInfo:
- location:
info: { "location": "documentView" "docInfo": { "docID": "", "clientDocID": "", "fileName": "", currentPageNo: 2 }, "eventInfo": { "pageInfo": { "pageNo":1, "rotation":90, "width":100, "height":100 }, "screenInfo": { "width":100, "height":100 }, "viewportCords": { "x":1, "y":1 }, "pageCords": { "x":1, "y":1 }, "pageHasAnnotations": false, "annotationInfo": [{ annID:"", zIndex:"" }], "textInfo": { "spanText":"", "spanX": 0, "spanY": 0 } "clickEventInfo": { } } }
Set Document Redact
setDocRedactCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever a document is redacted.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setDocRedactCallBack((docId) => { console.log("redactUpdated: docID " + docId); });
The callback method has one parameter:
(docId) => {}
- docId:
- Type: String value
- Description: ID of the document.
Set Tab Switch
setTabSwitchCallback(callback)
Summary:
The developer can pass the function object which will be invoked whenever the tab switching is completed.
Parameters:
- callback:
- Type: Function Object
- Description: The function object that is passed will have the following prototype.
this.callBackAPIService.setTabSwitchCallBack( (outFocusViewerDocID, inFocusViewerDocID) => { console.log("OutFocus ViewerDocId : " + outFocusViewerDocID); console.log("InFocus ViewerDocId: " + inFocusViewerDocID); } );
The callback method has two parameters:
(outFocusViewerDocID, inFocusViewerDocID) => {}
- outFocusViewerDocID:
- Type: String
- Description: ID of the document getting out of focus.
- inFocusViewerDocID:
- Type: String
- Description: ID of the document getting in focus.