Class: eViewerApp

Load Viewer

loadViewer()

Summary:

Initialize the viewer GUI and load viewer inside a div.

Parameters:

No parameters.

Returns:

Load viewer API returns the message for successfully loading of the viewer stored in the promise object.

Set Document End Point Options

setDocumentEndPointOptions(serverEndPoint: string, savingEndPoint: string, userName: string, options: any, ocrEndPoint: string)

Summary:
This API will set the loading end point of the document.

Parameters:

  • serverEndPoint: The format of the server end point will be:

    <Protocol>://<IPAddress>:<PortNumber>/<ServerApplicationName>/<FileUploadControllerName>

  • savingEndPoint:The format of the saving end point URL:

    <Protocol>://<IPAddress>:<PortNumber>/<ApplicationName>/<MehthodForSavingFileType>

    Example: http://192.168.10.100:8988/eViewer/createTiffFile

  • userName: Name of the document in the eViewer application.
  • ocrEndPoint: 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 completes.

Register License

registerLicense(licenseKey: string)

Summary:

Validates and registers the license key for the eViewer v7.

Parameters:

licenseKey: String based license key as provided by the sales team.

Returns:
A promise object, which is resolved once the license key is validated.

Scanning Document

setScannerPluginURL(scannerPluginUrl: string)

Summary:

Set the URL of the scanner plugin which the user will download.

Parameters:

  • scannerPluginUrl: 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, either to the left or to the right side of the document viewing area.

Parameters:
No parameters.

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

Select Panning

selectPanning(pan: boolean)

Summary:
Enables/disables page panning.

Parameters:

  • pan: Set to “true” to enable panning mode.

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

Hide Annotations

hideAnnotations(hide: boolean)

Summary:
Hides all annotations.

Parameters:

  • hide: 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: boolean)

Summary:

Show/hide the page or document thumbnails.

Parameters:

  • hide: contains a Boolean value.

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

Add Buttons

addButtons(leftCommonButtons: any, rightCommonButtons: any, ribbonCommonButtons: any)

Summary:

Add buttons to the document.

Parameters:

An array of objects which stores the value of each attribute such as id, name, alignment, icon Url and parent 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
  }
]

  • leftCommonButtons: It will hold the array of button objects which need to be displayed on the static left toolbar.
  • RightCommonButtons: It will hold the array of button objects which need to be displayed on the top right toolbar.
  • ribbonCommonButtons It will hold the array of button objects which need to be displayed on the ribbon toolbar in the middle. In this case, it is mandatory to provide the value of attribute ‘parent’.

Returns:

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

Update Buttons

updateButtons(leftCommonButtons: any, rightCommonButtons: any, ribbonCommonButtons: any)

Summary:

Update button needs to be called to up the state of an existing custom button

Parameters:

An array of objects which stores the value of each attribute such as id, name, alignment, icon Url and parent 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
  }
]

  • leftCommonButtons: It will hold the array of button objects which need to be displayed on the static left toolbar.
  • RightCommonButtons: It will hold the array of button objects which need to be displayed on the top right toolbar.
  • ribbonCommonButtons It will hold the array of button objects which need to be displayed on the ribbon toolbar in the middle. In this case, it is mandatory to provide the value of attribute ‘parent’.

Returns:

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

Remove Buttons

removeButtons(leftCommonButtons: any, rightCommonButtons: any, ribbonCommonButtons: any)

Summary:

Removes buttons from the UI.

Parameters:

An array of objects which stores the value of each attribute such as id, name, alignment, icon Url and parent 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
  }
]

  • leftCommonButtons: It will hold the array of button objects which need to be displayed on the static left toolbar.
  • RightCommonButtons: It will hold the array of button objects which need to be displayed on the top right toolbar.
  • ribbonCommonButtons It will hold the array of button objects which need to be displayed on the ribbon toolbar in the middle. In this case, it is mandatory to provide the value of attribute ‘parent’.

Returns:

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

Class: DocumentService

Insert Document

insertDocument(file: any, fileUrl: any, width?: any, height?: any, pageFilters?: any)

Summary:

Inserts a document in the viewer.

Parameters:

  • file: File object that carries file information
    {
      name: “sample.pdf”,
      type: “application/pdf”,
      size: 10000
    }
    
  • fileUrl: BASE64 encoded file data that contains the actual file content.
  • width & height [optional]: This is applicable in case of PNG, BMP, JPEG & GIF file formats, but not for PDF, MS Office or TIFF files. It is necessary to provide the width and height of the image file type document only.
  • pageFilters [optional]: 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(uploadDetail: any)

Summary:

Loads the document in viewer

Parameters:

  • uploadDetail: It is a JSON object which contains the information used to load a document. The object contains below attributes:
    • username [optional]: Can be provided for repositoryType ‘CM8’ if authentication details are to be passed from browser.
    • password [optional]: It is optional for both file system as well as CM8.
    • viewerUrl: URL to the eViewer server app in the below format:

      “<Protocol>://<servername or ip>:<port no>/<appName>/api/v1”>

      e.g., http://192.168.10.104:8087/eViewerServerv0.0.18/api/v1

    • repositoryType [mandatory]: It may be a ‘file system’ or ‘CM8’.
    • annotationUrl [optional]: URL of the JSON annotation stream to be loaded with the document. It can be absolute URL or URL to any controller method that returns document stream.
    • docDisplayName [mandatory]: Name of the document which need to be rendered in the eViewer application.
    • docUrl [mandatory]: URL of the document stream to be loaded. It can be absolute URL or URL to any controller method that returns document stream.
    • landingPage [optional]: Number type variable that stores the page number to be displayed when the document is rendered.
    • pageFilters [optional]: Stores the information of filtered pages including the page number and its visibility.

The schema of JSON is as follows:

{
  “name”: “sample.pdf”,
  "userName": "abc",
  "password":"",
  "viewerUrl": "http://192.168.10.100:9090/eViewerServer-0.0.16/api/v1",
  "repositoryType":"filesystem",
  "annotationUrl": "http://192.168.10.100:9090/eViewerServer-0.0.13/temp/1.json",
  "docDisplayName":"demo",
  "docUrl": "http://192.168.10.100:9090/eViewerServer-0.0.16/temp/pages.tif"
  "landingPage": 1
  "pageFilters": [{
           "pageNo": 1,
           "visible": true
  }]
 }

Returns:

A promise object upon resolve, the document ID is passed to the observer.After the promise object is resolved, it will show the filtered pages of the document.

Get All Open Documents

getOpenDocuments ()

Summary:
Provides a list of all open documents.

Parameters:
No parameters.

Returns:
A promise will be returned upon resolve, a JSON object with information (i.e., document ID and name) of all documents that have been rendered or are currently rendering will be passed.

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 document ID is passed as an argument.

Go To Document

gotoDocument(docId:string)

Summary:
Sets the focus to a selected document in the viewer.

Parameters:

  • docId: The unique document ID of the document to be viewed.

Returns:
A promise object will be resolved when the API finishes execution.

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.

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.

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.

Go to Page Traversing

gotoPage(pageNo: number),

Summary:
Navigates to the desired page of the document via the page number.

Parameters:

  • pageNo: Number type value from the user input.

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

Get Page Count

getPageCount(docId: string)

Summary:
Gets the total number pages of a document.

Parameters:

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

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

Filter Pages

filterPages(docId: string, pageFilters: any)

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: ID of the document
  • pageFilters:Holds the information of filtered pages.
    • pageNo:Stores the page number of the document.
    • visible: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 upon resolve, an object is received which indicates the success of applied filters.

{ 
  "success": true,
}

{ 
  "success": true, 
}

Show Only Pages

showOnlyPages(docId: string, pages: any)

Summary:

Show specified pages of the document and hide all others. If no pages are specified, then all pages will be displayed.

Parameters:

  • docId: ID of the document
  • pages: Pages numbers that need to be rendered. Pages can be stored in array of objects like [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: string, pages: any) Summary: Hide specified pages of the document and show all others. If no pages are specified, then all pages will be displayed. Parameters:
  • docId: ID of the document
  • pages: Pages numbers that need to be hidden. Pages can be stored in array of objects like [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: string)

Summary:

Get the document information.

Parameters:

  • docId: ID of the document.

Returns:
A promise object, upon being resolved, receives the document information.

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

Summary:

Get the page information.

Parameters:

  • docId: ID of the document.
  • pageRange: 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.

searchText(text:string)

Summary:
Search text in a document, and the results will be highlighted in the viewer.

Parameters:

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

New Document

newDocument(filetype: string)

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: 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 ID of the document is passed as an argument.

Append Document

appendDocument(file: any, base64FileData: any)

Summary:

Append another document in the already displayed document.

Parameters:

  • file: File object that carries file information.
    {
      name: “sample.pdf”,
      type: “application/pdf”,
      size: 10000
    }
    
  • base64FileData: 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.

Save Document

saveDocument(docId: string)

Summary:
Save the selected document to the provided saving endpoint with the setDocumentSavingEndPoint API.

Parameters:
No parameters.

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

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.

Close Document

closeDocument(docId: string)

Summary:
Closes the document rendered in the viewer.

Parameters:

  • docId: ID of the document to close.

Returns:
A promise object, which is resolved when the execution finishes, and ID of the document is passed as an argument.

Close All Documents

closeAllDocuments(docIds: string[])

Summary:
Close all documents rendered in the viewer.

Parameters:

  • docIds: This array contains the document IDs of all the documents to be closed.

Returns:
A promise object, which is resolved when the execution finishes, and the document IDs of all the documents is passed as an argument.

Class: EditingService

Fit to Width, Fit to Window, Fit to Height, Fit to Actual Size

zoomTo(preset: string)

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: String value from the user input. Valid inputs are:
    • Fit to Width
    • Fit to Window
    • Fit to Height
    • Fit to Actual Size

Returns:
A promise object, which is resolved when the execution finishes, and the current zoom percentage is passed as an argument.

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:
Rotate the selected page in a clockwise motion.

Parameters:
No parameters.

Returns:
A promise object, which is resolved when the execution finishes, and the new rotation angle is passed as an argument.

Copy Page

copyPage()

Summary:
Copies the selected page into viewer’s clipboard.

Parameters:
No parameters.

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

Cut Page

cutPage()

Summary:
Cuts the selected page into viewer’s clipboard.

Parameters:
No parameters.

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

Paste Page

pastePage()

Summary:
Adds the copied or cut page in the viewer’s clipboard to the document.

Parameters:
No parameters.

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

Delete Page

deletePage()

Summary:
Deletes the selected page.

Parameters:
No parameters.

Returns:
A promise object, which is resolved when the execution finishes, and the new page count is passed as an argument.

Get Current Scale

getCurrentScale(docId: string)

Summary:

Get the current scale information.

Parameters:

  • docId:ID of the document.

Returns:
A promise object, upon being resolved, receives the information about the document scale.

{ 
  "docId": "",
  "scale": 1.0
  "zoomPreset": "fitToWindow"
}

The Scale describes the zoom value of the page. It can be calculated in percentage by multiplying by 100.

Example:

Value Scale (%)
0.5 50
1.0 100
1.5 150

Value of zoom pre-set can be “fitToWindow”, “fitToWidth” or “none”.

Get Current Rotation

getCurrentRotation(docId: string, pageNo: Number)

Summary:
Get the current rotation information for a specific page of the document.

Parameters:

  • docId: ID of the document.
  • pageNo: 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: any)

Summary:
Export document will export the selected document with input options. It will open the PDF file directly.

Parameters:

  • exportData: This parameter takes a JSON object which contains the information to export a document.

    The schema of JSON is as follows:

    {
     "pageOption": "allDocuments",
     "docName":"test.pdf",
     "selectedOption": "pdf",
     "withAnn": false,
     "withWatermark": false,
     "asStream": false,
     "startPageExport": 1,
     "endPageExport": 3,
    }
    

    The description of JSON schema is as follows:

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

    • docName: The name of the document.
    • selectedOption: The possible values are ‘PDF’ or ‘Tiff’.
    • 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”.
    • withWatermark: If the string value is ‘true’, watermarks should be 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.li>
    • 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.

Returns:
A promise object, which is resolved when the execution finishes, and download the document to the browser.

printDocument(printData: any)

Summary:
Print document will print the selected document with input options. It will directly open the print dialog box.

Parameters:

  • printData: This parameter takes a JSON object which contains the information to print a document. Following attributes as described below:
    • 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.

    • withannotation: 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 definitely be included in printing, otherwise the value will be ‘false’.
    • withWatermark: If the string value is ‘true’, watermarks should be included in printing, otherwise the value will be ‘false’.
    • 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.

    The schema of JSON is as follows:

    {
     "pageOption":"allDocuments",
     "withannotation":"false",
     "withWatermark": false,
     "startPageExport": 1,
     "endPageExport": 3,
    }
    

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

Class: ViewerPreferenceService

Set User Preferences

setUserPreferences(preferences: any, shortcutPreferences: any, defaultAnnotationPropertyJSON: any, defaultActionScriptJSON: any, userName|: string)

Summary:
Set user preferences in the viewer settings.

Parameters:

  • preferences: This parameter contains a JSON input, described in detail.
  • shortcutPreferences: A new parameter to pass the updated shortcut preference JSON is now available in setUserPreferences API.
  • defaultAnnotationPropertyJSON: Object to annotation preferences, can be passed as undefined if preferences are to be loaded from assets folder via annotationProperty.json.
  • defaultActionScriptJSON [optional]: A object containing the action scripts for button annotation. If not provided, default scripts will be fetched from the assets folder via actionScripts.json.
  • userName: Name of the user.

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

Let’s discuss the user preferences in more detail:

  • JSON format:
    {
      "userId": "ibRGHYys",
      "username": "Administrator",
      "isAnnotationTabVisible": true,
      "isInsertTabVisible": true,
      "isRedactTabVisible": true,
      "isViewTabVisible": true,
      "saveDocument": true,
      "exportDocument": true,
      "print": true,
      "newDocument": true,
      "appendDocument": true,
      "pageNavigation": true,
      "hideThumbnails": true,
      "panning": true,
      "cutCopyPaste": true,
      "undo": true,
      "watermark": true,
      "deletePage": true,
      "split": true,
      "redaction": true,
      "searchRedact": true,
      "redactViewMode": true,
      "clearRedaction": true,
      "zoom": true,
      "fitToWindow": true,
      "fitToWidth": true,
      "actual": true,
      "thumbnailView": true,
      "rotate": true,
      "line": true,
      "arrow": true,
      "button": true,
      "rectangle": true,
      "circle": true,
      "highlight": true,
      "pen": true,
      "textAnnotation": true,
      "stamp": true,
      "polyLine": true,
      "polygon": true,
      "stickynote": true,
      "checkpoint": true,
      "view": "pageView",
      "zoomPreference":
      "actualControl",
      "textSearch": true,
      "showHideAnn": true,
      "closeAllFile": true,
      "closeFile": true,
      "newDocPre": "pdf",
      "switchThumb": "left",
      "isLogEnabled": false,
      "selectedOption": "info",
      "annComments": true,
      "isOcrEnabled": false,
      "firstChunkSize": 1
      "scanDocument": true,
      "insertDocument": true,
      "uploadDocument": true,
      "selectText": true
    }
    
  • Description of JSON attributes:
    Attribute Default Value Description
    userId "" Id of the user.
    username "" Name of the user.
    isAnnotationTabVisible true Show/Hide the annotation tab with all facilities.
    isInsertTabVisible true Show/Hide the insert tab with all controls.
    isRedactTabVisible true Show/Hide the redact tab with all features.
    isViewTabVisible true Show/Hide the view tab with all controls.
    saveDocument true Add/Remove the save document button.
    exportDocument true Add/Remove the export document button.
    print true Show/Hide the print document feature.
    newDocument true Add/Remove the new document button.
    appendDocument true Add/Remove the append document button.
    pageNavigation true Add/Remove page navigation group of controls, which includes previous page, next page, go to page and total number of pages.
    hideThumbnails true Add/Remove "hide thumbnails" button.
    panning true Show/Hide the feature of panning.
    cutCopyPaste true Show/Hide all three buttons for cut, copy and paste respectively.
    undo true Show/Hide the undo button.
    watermark true Add/Remove the facility of drawing watermarks.
    deletePage true Show/Hide the delete page functionality.
    split true Restricts the use of split function in case of false value.
    redaction true Add/Remove the redaction button.
    searchRedact true Show/Hide the search and redact button.
    reactViewMode true Add/Remove the redact view mode functionality.
    clearRedaction true Show/Hide the option of clear redaction.
    zoom true Add/Remove both the features of zoom in and zoom out.
    fitToWindow true Show/Hide the fit to window view control.
    fitToWidth true Show/Hide the fit to width view control.
    actual true Show/Hide the actual window control.
    thumbnailView true Add/Remove the thumbnail panel.
    rotate true Show/Hide the rotation button.
    line true Add/Remove the line annotation button.
    arrow true Add/Remove the arrow annotation button.
    button true Add/Remove the button annotation button.
    rectangle true Add/Remove the rectangle annotation button.
    circle true Add/Remove the circle annotation button.
    highlight true Add/Remove the highlight annotation button.
    pen true Add/Remove the pen annotation button.
    textAnnotation true Add/Remove the text annotation button.
    stamp true Add/Remove the stamp annotation button.
    polyline true Add/Remove the polyline annotation button.
    polygon true Add/Remove the polygon annotation button.
    stickynote true Add/Remove the sticky notes button.
    checkpoint true Add/Remove the checkpoint comments button.
    view "pageView" Defines the view of thumbnail window. The possible values are "pageView" and "docView".
    zoomPreference "actualControl" Defines the default zoom value. The possible values are "actualControl", "fitToWindowControl" and "fitToWidthControl".
    textSearch true Show/Hide the text search feature.
    showHideAnn true Add/Remove the show hide annotation button.
    closeAllFile true Show/Hide the close all file button from the tab.
    closeFile true Show/Hide the close file button from the tab.
    newDocPre "pdf" The format type for saving new documents.
    switchThumb "left" Represents the direction of thumbnail tab. The possible values are "left" and "right".
    isLogEnabled false To enable or disable the browser console logs.
    selectedOption "info" The level of logging in browser console. The possible values are "info" and "debug".
    annComments true Displays the annotation comments window on drawing any annotation.
    isOcrEnabled false Restricts the functionality of reading text in TIFF files.
    firstChunkSize 1 (mb) Controls the size of first chunk that is downloaded by the viewer.
    scanDocument true Show/Hide the scan document feature.
    insertDocument true Show/Hide the insert document feature.
    uploadDocument true Show/Hide the upload document feature.
    selectText true Show/Hide the select text feature.

Get User Preferences

getUserPreferences(userName: string, defaultPrefJSON: any, defaultShortcutPrefJSON: any, defaultAnnotationPropertyJSON: any)

Summary:
Get user preferences from the user.

Parameters:

  • userName: Name of the user for which viewer’s settings needs to be modified.
  • defaultPrefJSON [optional]: Object to viewer preferences, can be passed as undefined if preferences are to be loaded from assets folder via UserPreferences.json.
  • defaultShortcutPrefJSON: This is an optional parameter and it is functional. Shortcut 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.
    Key Command Title
    Alt+= zoomin Zoom In
    Alt+- zoomout Zoom Out
    Shift+S save Save
    Ctrl+Shift+X export Export
    Shift+P print Print
    Shift+HOME firstpage First Page
    Shift+END lastpage Last Page
    Alt+PAGEUP previouspage Previous Page
    Alt+PAGEDOWN nextpage Next Page
    Shift+R rotateclockwise Rotate
    Ctrl+Alt+B thumbnails Thumbnails
    Ctrl+Shift+Y redaction Redaction
    Alt+P search and redact Search And Redact
    Shift+Z redact view mode Redact View Mode
    Ctrl+Alt+L line Line
    Ctrl+Alt+R rectangle Rectangle
    Ctrl+Alt+C circle Circle
    Shift+Alt+O arrow Arrow
    Ctrl+Alt+P pen Pen
    Shift+Alt+H highlight Highlight
    Shift+Alt+K text Text
    Shift+Alt+S stamp Stamp
    Shift+Alt+M polyline Polyline
    Shift+Alt+N polygon Polygon
    Shift+Ctrl+Q checkpoint Checkpoint
    Ctrl+Alt+W watermark Watermark
    Ctrl+/ comments Comments
    Ctrl+M show-hide annotations Show-Hide Annotations
    DELETE delete annotations Delete Annotations
    Ctrl+1 actual size Actual Size
    Ctrl+2 fit to width Fit To Width
    Ctrl+3 fit to window Fit To Window
    Ctrl+X cut page Cut Page
    Ctrl+DELETE delete page Delete Page
    Ctrl+C copy page Copy Page
    Ctrl+V paste page Paste Page
    Ctrl+Shift+F search Search
    Shift+< previous search Previous Search
    Shift+> next search Next Search
    Alt+I version number Version Number
    Alt+H show keyboard hint Show Hotkeys Hint
  • defaultAnnotationPropertyJSON: Object to annotation preferences, can be passed as undefined if preferences are to be loaded from assets folder via annotationProperty.json.

Returns:
A promise object, which is resolved when the execution finishes, and the preferences are passed as an argument.

User Preference JSON object (defaultPrefJSON) will be of below format:

{
  userId: "ibRGHYys",
  username: "Administrator",
  isAnnotationTabVisible: true,
  isInsertTabVisible: true,
  isRedactTabVisible: true,
  isViewTabVisible: true,
  saveDocument: true,
  exportDocument: true,
  print: true,
  scanDocument: true,
  insertDocument: true,
  uploadDocument: true,
  newDocument: true,
  appendDocument: true,
  pageNavigation: true,
  hideThumbnails: true,
  panning: true,
  cutCopyPaste: true,
  undo: true,
  watermark: true,
  deletePage: true,
  split: true,
  redaction: true,
  searchRedact: true,
  redactViewMode: true,
  clearRedaction: true,
  zoom: true,
  fitToWindow: true,
  fitToWidth: true,
  actual: true,
  thumbnailView: true,
  sideBysideView: false,
  rotate: true,
  line: true,
  arrow: true,
  button: true,
  selectText: true,
  rectangle: true,
  circle: true,
  highlight: true,
  pen: true,
  textAnnotation: true,
  stamp: true,
  polyLine: true,
  polygon: true,
  stickynote: true,
  checkpoint: true,
  view: "pageView",
  zoomPreference: "actualControl",
  textSearch: true,
  showHideAnn: true,
  closeAllFile: true,
  closeFile: true,
  newDocPre: "pdf",
  switchThumb: "left",
  isLogEnabled: false,
  selectedOption: "info",
  annComments: true,
  isOcrEnabled: false,
  firstChunkSize: 1,
  };

User Preference JSON object (defaultAnnotationPropertyJSON) will be of below format:

[
 {
    annId: "AvG52nYt",
    annType: "Polygon",
    borderWidth: "5",
    fillColor: "#96FEFE",
    fontSize: "0",
    height: "0",
    opacity: "1.0",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "eN5ilLAu",
    annType: "Masking",
    borderWidth: "0",
    fillColor: "#000000",
    fontSize: "0",
    height: "0",
    opacity: "0.3",
    reason: "Spousal, Reporter,                         
             SEP, Minor",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "OUE86Exp",
    annType: "Highlight",
    borderWidth: "0",
    fillColor: "#FFFF00",
    fontSize: "0",
    height: "0",
    opacity: "0.4",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "cZ6XuhnO",
    annType: "Cloud",
    borderWidth: "5",
    fillColor: "#96FEFE",
    fontSize: "0",
    height: "0",
    opacity: "0.5",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "ciwSuCgl",
    annType: "Rectangle",
    borderWidth: "5",
    fillColor: "#96FEFE",
    fontSize: "0",
    height: "0",
    opacity: "0.5",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "kYZrDNV8",
    annType: "Circle",
    borderWidth: "5",
    fillColor: "#96FEFE",
    fontSize: "0",
    height: "0",
    opacity: "0.5",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "O2h6McHO",
    annType: "Pen",
    borderWidth: "5",
    fontSize: "0",
    height: "0",
    opacity: "1.0",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "xqJv8s3g",
    annType: "Line",
    borderWidth: "5",
    fontSize: "0",
    height: "0",
    opacity: "1.0",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "RdzxWMIx",
    annType: "Stickynote",
    borderWidth: "1",
    fillColor: "#FFFF00",
    fontSize: "0",
    height: "0",
    opacity: "0.5",
    reason: "Concern,
       Scheduling, Estimate,
       Resources, Feasibility,
       Cost/Benefit, Deliverable",
    strokeColor: "#000000",
    title: "Project, Missing,
        Status, Issue, Agreement,
        Change, Action",
    type: "1",
    userType: "0",
    width: "0",
 },
 {
    annId: "H1BG4HXl",
    annType: "Redaction",
    borderWidth: "0",
    fillColor: "#000000",
    fontSize: "0",
    height: "0",
    opacity: "0.3",
    reason: "Spousal, Reporter, 
             SEP, Minor",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "2u79iVNI",
    annType: "Arrow",
    borderWidth: "5",
    fontSize: "0",
    height: "0",
    opacity: "1.0",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "dyGhcT36",
    annType: "Text",
    borderWidth: "5",
    fillColor: "#FFFFFF",
    fontColor: "#000000",
    fontFace: "Helvetica",
    fontSize: "48",
    height: "0",
    opacity: "0.5",
    strokeColor: "#000000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "dyGhcT37",
    annType: "Button",
    borderWidth: "0",
    fillColor: "#00A2E8",
    fontColor: "#000000",
    fontFace: "Helvetica",
    fontSize: "18",
    height: "0",
    opacity: "1",
    strokeColor: "#000000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "J3enMeMM",
    annType: "PolyLine",
    borderWidth: "5",
    fontSize: "0",
    height: "0",
    opacity: "1.0",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "qcEPGSp7",
    annType: "CheckPoint",
    borderWidth: "2",
    fillColor: "#96FEFE",
    fontSize: "0",
    height: "0",
    opacity: "0.5",
    strokeColor: "#FF0000",
    type: "0",
    userType: "0",
    width: "0",
 },
 {
    annId: "zTnnEv0H",
    annType: "Stamp",
    borderWidth: "5",
    fillColor: "#FFFF00",
    fontColor: "#000000",
    fontFace: "Helvetica",
    fontSize: "48",
    height: "150",
    opacity: "1.0",
    strokeColor: "#000000",
    type: "1",
    userType: "0",
    width: "150",
 },
]

Class: WatermarkService

Watermark

newWatermark(properties: any)

Summary:
Creates a new watermark.

Parameters:

  • properties: This parameter takes a JSON object which 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.

Class: AnnotationService

Select Shape

selectShape(annType: any, options?: any)

Summary:
Select shape for which type of annotation needs to be drawn.

Parameters:

  • annType:
    • Type: Annotation type
    • Description: Type of the annotation drawing. Possible values would be: line, arrow, circle, rectangle, highlight, stamp, text, stickynote and 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(defaultStamps: any)

Summary:
Get stamps API will provide the information about the image stamp to Select Shape API.

Parameters:

  • defaultStamps [optional]: An object to list of all stamps in below format, if not provided then can be set to undefined in which case the image stamps will be fetched via assets folder.

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

Edit Shape

editShape(annId: string, pageNo: number, position: any, options: any)

Summary:
It will modify the annotations according to the new position and updated properties.

Parameters:

  • annId: The ID of the annotation.
  • pageNo: Page number on which annotation has been drawn.
  • position: It stores the coordinates of the shape (annotation) to be drawn.
    {
     x: 0,
     y, 0,
     width: 0,
     height: 0
    } 
    
  • options: It stores additional information if required for any specific annotation.
    {
      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: number, annId: string)

Summary:
It will delete the annotation with the respective annotation ID.

Parameters:

  • pageNo: Page number on which annotation has been drawn.
  • annId: The ID of the corresponding annotation.

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

Get All Annotations

getAllAnnotations(userName: string)

Summary:

It will return all the annotations on the document.

Parameters:

  • userName [optional]: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: string)

Summary:

It will provide the details of the respective annotation whose Id is entered as a parameter.

Parameters:

  • annId: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 Annotations By Filter

getAnnotationsByFilter(userName: string, annType: string, pageNo: integer)

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]: Show all the annotations for the specific username. In case, there is no username provided, then all the annotations will be returned.
  • annType [optional]: The type of annotation can be: Line, Rectangle, Circle, Arrow, Highlight, Text, Stamp, Stickynote or CheckPoint.
  • PageNo [optional]: 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: string, textUpdate: string, replyId: string)

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: ID of the annotation.
  • textUpdate: The text which needs to be edited.
  • replyId: 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: string, replyText: string)

Summary:
Add a reply to the annotation.

Parameters:

  • annId: ID of the annotation.
  • replyText: It stores the reply text.

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

Get Reply by User

getReplyByUser(annId: string)

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: ID of the annotation.

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

Get All Replies

getAllReplies(annId: string)

Summary:
Return all replies of an annotation.

Parameters:

  • annId: 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: string, annId: string)

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: Id of the reply which is required to be removed.
  • annId: ID of the annotation.

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

Remove All Replies

removeAllReplies(annId: string)

Summary:
Remove all replies for a particular annotation id. Current user can remove all his replies, but not any other reply.

Parameters:

  • annId: ID of the annotation.

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