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.
  • 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"
}

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.

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.

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.
      • 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",
                }]
              }
            

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:
      • PDF
      • 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 Document Info

getDocumentInfo(docId)

Summary:

Get the document information.

Parameters:

  • docId:
    • Type: String
    • Description: ID of the document.

Returns:
A promise object upon resolve, an object is received which indicates the success of applied filters.

{ 
  "docId": "", 
  "clientDocId": "", 
  "docName": "", 
  "size": 0, 
  "pageCount": 0, 
  "fileFormat": "PDF" 
}  

File format can be: PDF, TIFF, PNG, JPG, BMP, GIF, TXT.

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.

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,
attributes of the object

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.

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:

ValueScale (%)
0.550
1.0100
1.5150

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.

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:
          1. DOWNLOAD – Downloads the document to browse.
          2. EXPORT – Returns the binary typed array stream of the document that can be saved onto the desired location.
          3. 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.

    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": {
          "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,
          "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:

AttributeTypeSub AttributesRelease VersionSub Attribute TypeDefault ValueDescription
userInfoObjectuserIdv7.0.307.2 and higherString“”Id of the user.
userInfoObjectusernamev7.0.307.2 and higherString“”Name of the user.
leftDocToolbarObjecthideThumbnailsv7.0.307.2 and higherBooleantrueAdd/Remove “hide thumbnails” button.
leftDocToolbarObjectpanningv7.0.307.2 and higherBooleantrueAdd/Remove the feature of panning.
leftDocToolbarObjectzoomv7.0.307.2 and higherBooleantrueAdd/Remove both the features of zoom in and zoom out.
leftDocToolbarObjectrotatev7.0.307.2 and higherBooleantrueAdd/Remove the rotation button.
leftDocToolbarObjectfitToWindowv7.0.307.2 and higherBooleantrueAdd/Remove the fit to window view control.
leftDocToolbarObjectfitToWidthv7.0.307.2 and higherBooleantrueAdd/Remove the fit to width view control.
leftDocToolbarObjectactualv7.0.307.2 and higherBooleantrueAdd/Remove the actual button.
leftDocToolbarObjectrubberbandZoomv7.0.318.3BooleantrueAdd/Remove the rubberband zoom button.
rightViewerToolbarObjectuploadDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the upload document feature.
rightViewerToolbarObjectviewCheckpointsv7.0.307.2 and higherBooleantrueAdd/Remove the feature for viewing checkpoints.
rightViewerToolbarObjectinsertDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the insert document feature.
rightViewerToolbarObjectsettingsv7.0.307.2 and higherObject
rightViewerToolbarObjectnewDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the new document button.
rightViewerToolbarObjectscanDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the scan document feature.
rightViewerToolbarObjectcloseFilev7.0.307.2 and higherBooleantrueAdd/Remove the close file button from the tab.
rightViewerToolbarObjectcloseAllFilev7.0.307.2 and higherBooleantrueAdd/Remove the close all file button from the tab.
rightViewerToolbarObjectsaveDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the save document button.
rightViewerToolbarObjectviewCommentsv7.0.307.2 and higherBooleantrueAdd/Remove the feature for viewing comments.
rightViewerToolbarObjectdocMetadatav7.0.307.2 and higherBooleantrueAdd/Remove the document metadata button.
rightViewerToolbarObjectattachmentsv7.0.307.2 and higherBooleantrueAdd/Remove the attachments button from the tab.
rightViewerToolbarObjectaddNotesv7.0.307.2 and higherBooleantrueAdd/Remove the add notes button.
rightViewerToolbarObjectuserPreferencesv7.0.307.2 and higherBooleantrueAdd/Remove the user preferences button.
rightViewerToolbarObjectinfov7.0.307.2 and higherBooleantrueEnable/Disable the information button which shows the version number of the application.
rightDocToolbarObjectpageNavigationv7.0.307.2 and higherBooleantrueAdd/Remove page navigation group of controls, which includes previous page, next page, go to page and total number of pages.
thumbnailToolbarObjectpopInOutv7.0.307.2 and higherBooleanfalseAdd/Remove the pop in out button.
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“View”Name of the view ribbon toolbar.
ribbonToolbarArray of ObjectsisViewTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the view tab with all controls.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Insert”Name of the insert toolbar.
ribbonToolbarArray of ObjectsisInsertTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the insert tab with all controls.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Annotate”Name of the annotation toolbar.
ribbonToolbarArray of ObjectsisAnnotationTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the annotation tab with all facilities.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Redact”Name of the redaction toolbar.
ribbonToolbarArray of ObjectsisRedactTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the redact tab with all features.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Signature”Name of the signature toolbar.
ribbonToolbarArray of ObjectsisSignatureTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the signature tab with the feature.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Speech”Name of the speech toolbar.
ribbonToolbarArray of ObjectsisSpeechTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the speech tab with all the features.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Compare”Name of the compare toolbar.
ribbonToolbarArray of ObjectsisCompareTabVisiblev7.0.307.2 and higherBooleantrueAdd/Remove the compare tab with all the features.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
ribbonToolbarArray of Objectsnamev7.0.307.2 and higherString“Medify”Name of the medify toolbar.
ribbonToolbarArray of ObjectsisMedifyTabVisiblev7.0.307.2 and higherBooleanfalseSet to ‘true’ to show the medify tab with all the features whenever an audio or video file is rendered.
ribbonToolbarArray of Objectschildrenv7.0.307.2 and higherObject
generalObjectviewv7.0.307.2 and higherString“pageView”Defines the view of thumbnail window. The possible values are “pageView” and “docView”.
generalObjectzoomPreferencev7.0.307.2 and higherString“actualControl”Defines the default zoom value. The possible values are “actualControl”, “fitToWindowControl” and “fitToWidthControl”.
generalObjectnewDocPrev7.0.307.2 and higherString“pdf”The format type for saving new documents.
generalObjectswitchThumbv7.0.307.2 and higherString“left”Represents the direction of thumbnail tab. The possible values are “left”, “right”, “top”, and “bottom”.
generalObjectisLogEnabledv7.0.307.2 and higherBooleanfalseTo enable or disable the browser console logs.
generalObjectselectedOptionv7.0.307.2 and higherString“info”The level of logging in browser console. The possible values are “info” and “debug”.
generalObjectisOcrEnabledv7.0.307.2 and higherBooleantrueSet to ‘false’ to restricts the functionality of searching text in image files.
generalObjectfirstChunkSizev7.0.307.2 and highernumber1 (mb)Controls the size of first chunk that is downloaded by the viewer.
generalObjectannCommentsv7.0.307.2 and higherBooleanfalseSet to ‘true’ to display the annotation comments window on drawing any annotation.
generalObjectcacheManagerSizev7.0.307.2 and highernumber25 (mb)The total memory size of the cache manager.
generalObjectwaitTimev7.0.307.2 and highernumber5Wait until the (0.5 seconds) time limit is reached and display the thumbnails without the icon.
generalObjectshowDocThumbBarv7.0.307.2 and higherBooleantrueThe document thumbnails will show up as usual. Set to ‘false’ to hide the document thumbnails.
generalObjectshowDocSignPanelv7.0.307.2 and higherBooleantrueThe document signature panel will be displayed. Set to ‘false’ to hide the document signature panel.
generalObjectautogrowDocTabWidthv7.0.307.2 and higherBooleanfalseFilename will cut off as usual, by default,. Set to ‘true’ to enable it to auto fit.
generalObjectembedAnnotationOnStampingv7.0.307.2 and higherBooleantrueEmbed annotation into PDF on stamping the document instead of saving in JSON.
generalObjectenablePDFLockAfterSigningv7.0.307.2 and higherBooleanfalseSet to ‘true’ to restrict the PDF document from being edited after applying a digital signature.
generalObjectpdfFlatteningv7.0.307.2 and higherBooleanfalseSet to ‘true’ to restrict the functionality of editing the form fields.
generalObjectthumbnailZoomControlsv7.0.307.2 and higherBooleantrueAdd/Remove the thumbnail size toolbar.
generalObjectredactInJSONv7.0.307.2 and higherBooleantrueTo save the redacted file in JSON or set to ‘false’ to directly burn it into the document.
generalObjectsaveOnlyIfModifiedv7.0.307.2 and higherBooleanfalseSet to ‘true’ to save only modified document.
generalObjectblockingSpinnerOnSavev7.0.307.2 and higherBooleanfalseSet to ‘true’ to enable the blocking spinner on save.
generalObjecthideInViewerNotificationsv7.0.307.2 and higherBooleanfalseSet to ‘true’ to hide the alert messages in the viewer.
generalObjectenableHyperlinksByRegExv7.0.315String*To enable all the hyperlinks in the documents.
generalObjectsaveAnnotationAsMimeTypev7.0.327String“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.
docTabPreferencesObjectfocusTabStylev7.0.307.2 and higherObjectTo style the tab which is in focus.
docTabPreferencesObjecttabStylev7.0.307.2 and higherObjectTo style the tab which is not in focus.
compareDocsPreferenceObjectdetailPreferencev7.0.307.2 and higherObjectProvide the details of the comparison result.
compareDocsPreferenceObjectdisplayPreferencev7.0.307.2 and higherObjectTo set the preferences for comparison between the two documents.

Settings for Right Viewer Toolbar

AttributeRelease VersionTypeDefault ValueDescription
insertDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the insert document button.
exportDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the export document button.
downloadv7.0.307.2 and higherBooleantrueAdd/Remove the download button.
printv7.0.307.2 and higherBooleantrueAdd/Remove the print button.
saveDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the save document button.
newDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the new document button.

Children for View Toolar

AttributeRelease VersionTypeDefault ValueDescription
splitv7.0.307.2 and higherBooleantrueRestricts the use of split function in case of false value.
undov7.0.307.2 and higherBooleantrueAdd/Remove the undo button.
invertv7.0.307.2 and higherBooleantrueAdd/Remove the invert button.
copyPgToClipboardv7.0.307.2 and higherBooleantrueAdd/Remove the copy to the clipboard button.
thumbnailViewv7.0.307.2 and higherBooleantrueAdd/Remove the thumbnail panel.
sideBysideViewv7.0.307.2 and higherBooleantrueAdd/Remove the side by side view button from the tab.
textSearchv7.0.307.2 and higherBooleantrueAdd/Remove the text search feature.
selectTextv7.0.307.2 and higherBooleantrueAdd/Remove the select text feature.

Children for Insert Toolar

AttributeRelease VersionTypeDefault ValueDescription
cutCopyPastev7.0.307.2 and higherBooleantrueAdd/Remove all three buttons for cut, copy and paste respectively.
deletePagev7.0.307.2 and higherBooleantrueAdd/Remove the delete page functionality.
checkpointv7.0.307.2 and higherBooleantrueAdd/Remove the checkpoint comments button.
appendDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the append document button.
watermarkv7.0.307.2 and higherBooleantrueAdd/Remove the facility of drawing watermarks.
snippingToolv7.0.307.2 and higherBooleantrueAdd/Remove the snipping tool button.
trimPagev7.0.307.2 and higherBooleantrueAdd/Remove the trim page button.

Children for Annotate Toolar

AttributeRelease VersionTypeDefault ValueDescription
linev7.0.307.2 and higherBooleantrueAdd/Remove the line annotation button.
arrowv7.0.307.2 and higherBooleantrueAdd/Remove the arrow annotation button.
circlev7.0.307.2 and higherBooleantrueAdd/Remove the circle annotation button.
rectanglev7.0.307.2 and higherBooleantrueAdd/Remove the rectangle annotation button.
penv7.0.307.2 and higherBooleantrueAdd/Remove the pen annotation button.
highlightv7.0.307.2 and higherBooleantrueAdd/Remove the highlight annotation button.
textAnnotationv7.0.307.2 and higherBooleantrueAdd/Remove the text annotation button.
stampv7.0.307.2 and higherBooleantrueAdd/Remove the stamp annotation button.
polylinev7.0.307.2 and higherBooleantrueAdd/Remove the polyline annotation button.
polygonv7.0.307.2 and higherBooleantrueAdd/Remove the polygon annotation button.
cloudv7.0.307.2 and higherBooleantrueAdd/Remove the cloud annotation button.
stickynotev7.0.307.2 and higherBooleantrueAdd/Remove the sticky notes button.
buttonv7.0.307.2 and higherBooleantrueAdd/Remove the button annotation button.
showHideAnnv7.0.307.2 and higherBooleantrueAdd/Remove the show hide annotation button.

Children for Redact Toolar

AttributeRelease VersionTypeDefault ValueDescription
redactSelectedTextv7.0.307.2 and higherBooleantrueAdd/Remove the redact selected text button.
redactWordv7.0.307.2 and higherBooleantrueAdd/Remove the redact word button.
redactionv7.0.307.2 and higherBooleantrueAdd/Remove the redaction button.
searchRedactv7.0.307.2 and higherBooleantrueAdd/Remove the search and redact button.
clearRedactionv7.0.307.2 and higherBooleantrueAdd/Remove the option of clear redaction.
redactPagev7.0.307.2 and higherBooleantrueAdd/Remove the redact page button.
redactViewModev7.0.307.2 and higherBooleantrueAdd/Remove the redact view mode functionality.

Children for Signature Toolar

AttributeRelease VersionTypeDefault ValueDescription
drawSignaturev7.0.307.2 and higherBooleantrueAdd/Remove the facility of drawing signature button.

Children for Speech Toolar

AttributeRelease VersionTypeDefault ValueDescription
previousPageSpeechv7.0.307.2 and higherBooleantrueAdd/Remove the previous page speech button.
playv7.0.307.2 and higherBooleantrueAdd/Remove the play speech button.
pausev7.0.307.2 and higherBooleantrueAdd/Remove the pause speech button.
stopv7.0.307.2 and higherBooleantrueAdd/Remove the stop speech button.
nextPageSpeechv7.0.307.2 and higherBooleantrueAdd/Remove the next page speech button.
speechSpeedv7.0.307.2 and higherBooleantrueAdd/Remove the speech speed button.

Children for Compare Toolar

AttributeRelease VersionTypeDefault ValueDescription
comparedocsViewv7.0.307.2 and higherBooleantrueAdd/Remove the compare document button.
startSyncv7.0.307.2 and higherBooleantrueAdd/Remove the start sync button.
closeComapreDocumentsv7.0.307.2 and higherBooleantrueAdd/Remove the close compare documents button.
comparePanelv7.0.307.2 and higherBooleantrueAdd/Remove the compare panel button.

Children for Medify Toolar

AttributeRelease VersionTypeDefault ValueDescription
addSnapshotv7.0.307.2 and higherBooleantrueAdd/Remove the add snapshot button.
openSnapshotAsNewDocumentv7.0.307.2 and higherBooleantrueAdd/Remove the open snapshot as new document button.
enableDisableCommentSubtitlev7.0.307.2 and higherBooleantrueAdd/Remove the enable disable comment subtitle button.

Attributes of Focus Tab Style

AttributeRelease VersionTypeDefault ValueDescription
backgroundColorv7.0.307.2 and higherString“#0853B5”Represents the background color of the tab.
colorv7.0.307.2 and higherString“#fff”Represents the color of the font.
fontWeightv7.0.307.2 and higherNumber400To 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)
fontStylev7.0.307.2 and higherString“normal”To set the style of the font to normal, italic, or underline.
fileNamev7.0.307.2 and higherString“”Contains the name of the file to be displayed.
iconv7.0.307.2 and higherString“”Stores the BASE64 image of the icon to be displayed over the documents tab.

Attributes of Tab Style

AttributeRelease VersionTypeDefault ValueDescription
backgroundColorv7.0.307.2 and higherString“#f7f7f7”Represents the background color of the tab.
colorv7.0.307.2 and higherString“#545454”Represents the color of the font.
fontWeightv7.0.307.2 and higherNumber400To 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)
fontStylev7.0.307.2 and higherString“normal”To set the style of the font to normal, italic, or underline.
fileNamev7.0.307.2 and higherString“”Contains the name of the file to be displayed.
iconv7.0.307.2 and higherString“”Stores the BASE64 image of the icon to be displayed over the documents tab.

Attributes of Detail Preference

AttributeRelease VersionTypeDefault ValueDescription
fullDetailv7.0.307.2 and higherBooleanfalseSet to ‘true’ to generate full details of comparison result.

Attributes of Display Preference

AttributeRelease VersionTypeDefault ValueDescription
textInfov7.0.307.2 and higherBooleantrueSet to ‘true’ to generate full details of comparison result.
imageInfov7.0.307.2 and higherBooleanfalseSet to ‘true’ to display the images comparison between the two documents.
graphicsInfov7.0.307.2 and higherBooleanfalseSet to ‘true’ to display the graphics comparison between the two documents.
annotInfov7.0.307.2 and higherBooleanfalseSet 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:

      KeyCommandTitle
      Alt+=zoominZoom In
      Alt+-zoomoutZoom Out
      Shift+SsaveSave
      Ctrl+Shift+XexportExport
      Shift+PprintPrint
      Shift+HOMEfirstpageFirst Page
      Shift+ENDlastpageLast Page
      Alt+PAGEUPpreviouspagePrevious Page
      Alt+PAGEDOWNnextpageNext Page
      Shift+RrotateclockwiseRotate
      Ctrl+Alt+BthumbnailsThumbnails
      Ctrl+Shift+YredactionRedaction
      Alt+Psearch and redactSearch And Redact
      Shift+Zredact view modeRedact View Mode
      Ctrl+Alt+LlineLine
      Ctrl+Alt+RrectangleRectangle
      Ctrl+Alt+CcircleCircle
      Shift+Alt+OarrowArrow
      Ctrl+Alt+PpenPen
      Shift+Alt+HhighlightHighlight
      Shift+Alt+KtextText
      Shift+Alt+SstampStamp
      Shift+Alt+MpolylinePolyline
      Shift+Alt+NpolygonPolygon
      Shift+Ctrl+QcheckpointCheckpoint
      Ctrl+Alt+WwatermarkWatermark
      Ctrl+/commentsComments
      Ctrl+Mshow-hide annotationsShow-Hide Annotations
      DELETEdelete annotationsDelete Annotations
      Ctrl+1actual sizeActual Size
      Ctrl+2fit to widthFit To Width
      Ctrl+3fit to windowFit To Window
      Ctrl+Xcut pageCut Page
      Ctrl+DELETEdelete pageDelete Page
      Ctrl+Ccopy pageCopy Page
      Ctrl+Vpaste pagePaste Page
      Ctrl+Shift+FsearchSearch
      Shift+<previous searchPrevious Search
      Shift+>next searchNext Search
      Alt+Iversion numberVersion Number
      Alt+Hshow keyboard hintShow Hotkeys Hint
  • loadFromAssets [optional]:
    • 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 NameTypeDescription
idString“in case of adding new watermark, in case of editing provide id position”
textStringthe text user wants to display style.
styleStringwhere the text should be displayed. (top, center, bottom, diagonal, revdiagonal)
positionStringposition string from where the text should start. (left, center, right)
opacityStringalpha value of the text. (transparent, opaque)
stretchStringpercentage at which the text should be displayed. (100, 50, 33)
fontStringfont of the text. (Courier, Helvetica, Times-Roman)
pageOptionStringon 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:

AttributeTypeDescription
stampNameStringThe name of the stamp appears in the stamp list.
mimeTypeStringType of image stamp. Note: Only PNG image format is currently supported. Hence should be set to “png”
stampURLStringIt 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’:
      • annCanvasStartX: Start X position of the annotation.
        Note: The attribute name will be updated to “x” in the upcoming build.
      • annCanvasStartY: Start Y position of the annotation.
        Note: The attribute name will be updated to “y” in the upcoming build.
      • annCanvasEndX: Width of the annotation.
        Note: The attribute name will be updated to “width” in the upcoming build.
      • annCanvasEndY: Height of the annotation.
        Note: The attribute name will be updated to “height” in the upcoming build.
      • x1: Start “x” position of stamp annotation.
        Note: This parameter will be removed in future build and will be passed via “annCanvasStartX”.
      • y1: Start position of stamp annotation.
        Note: This parameter will be removed in future build and will be passed via “annCanvasStartY”.
      const position = {
            annCanvasStartX: 0, 
            annCanvasEndX: 0,
            annCanvasStartY: 100,
            annCanvasEndY: 100,
            x1: , // For stamp only
            y1: , // For stamp only
          };
      
      
  • options:
    • Type: JSON object
    • Description: Not implemented yet, should be set as null, however, will contain the object that would store annotation properties
      {
        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"
      }
      

Returns:
A promise object, which is resolved when the execution finishes.

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.

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’:
      • annCanvasStartX: Start X position of the annotation.
        Note: The attribute name will be updated to “x” in the upcoming build.
      • annCanvasStartY: Start Y position of the annotation.
        Note: The attribute name will be updated to “y” in the upcoming build.
      • annCanvasEndX: Width of the annotation.
        Note: The attribute name will be updated to “width” in the upcoming build.
      • annCanvasEndY: Height of the annotation.
        Note: The attribute name will be updated to “height” in the upcoming build.
      • x1: Start “x” position of stamp annotation.
        Note: This parameter will be removed in future build and will be passed via “annCanvasStartX”.
      • y1: Start position of stamp annotation.
        Note: This parameter will be removed in future build and will be passed via “annCanvasStartY”.
      const position = {
            annCanvasStartX: 0, 
            annCanvasEndX: 0,
            annCanvasStartY: 100,
            annCanvasEndY: 100,
            x1: , // For stamp only
            y1: , // For stamp only
          };
      
      
  • options:
    • Type: JSON object
    • Description: Not implemented yet, should be set as null, however, will contain the object that would store annotation properties
      {
        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"
      }
      

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.
  • 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

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.

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.
  • 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",
               }]
             
  • 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.
          {
           memoryUsed: 3
           memoryAvailable: 17
           details: [{
            docId: "ID of document",
            cacheEntries: 0
          }]
        }
      

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.
      • 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.

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: "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.
      • 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.
          • 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.
          • 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.
          • 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.
          • 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.
          • 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.
          • 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": {
                                      }
                                   }
                                  }
            
                          

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: "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.
      • 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.
          • 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.
          • 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.
          • 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.
          • 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.
          • 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.
          • 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": {
      }
    }
}

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.