Namespace: ViewerInstance

WebPDF. ViewerInstance

Methods


<static> canRedo()

Check if it can redo

Returns:
Type
boolean

<static> canUndo()

Check if it can undo

Returns:
Type
boolean

<static> closeFile()

Close current PDF file.

Returns:

True if close successful, else return false.

Type
Boolean

<static> enableJSAction(enable)

Function defined to enable JavaScript action or not.

Parameters:
Name Type Description
enable Boolean

JavaScript or not.


<static> enableSafeMode(enable)

Function defined to enable safe mode or not.

Parameters:
Name Type Description
enable Boolean

safe mode or not.


<static> exportAnnotsToFDF()

Export annotations of current document into a FDF file.

This function supports the following annotation types:
highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea
Current support only comments data and does not include PDF form data.

Example
WebPDF.ViewerInstance.exportAnnotsToFDF();

<static> exportAnnotsToJson()

Export annotations of current document to JSON data.

This function supports the following annotation types: highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea
Current support only comments data and not include PDF form data.

Returns:

a promise that resolves to an object with info for all doucment annotations.

     Returns the corresponding field of the value
     type: "ty",
     flag: "f",
     rect: "rc",
     content: "c",
     name: "n",
     borderWidth: "bw",
     borderStyle: "bs",
     color: "cl",
     fillColor:"fcl",
     dash:"d",
     highlight: "hl",
     quadPoints: "Quad",
     destinationInfo: "ds",
     openState: "op",
     modifyDate: "md",
     state: "st",
     stateModel: "stm",
     opacity: "ca",
     creationDate: "cd",
     subject: "subj",
     title: "tit",
     popup: "pop",
     replyChain: "rpy",
     stateList: "stat",
     action: "act",
     group: "grp",
     subType: "subty",
     textAnnotName: "txtn",
     ft: "ft",
     defaultAp: "da",
     fontSize: "fs",
     fontColor: "fc",
     fontName: "ftn",
     lineHeight: "lnh",
     fontHeight: "fh",
     textAlign: "q",
     it: "it",
     inkList: "ikl",
     inkColor: "ikc",
     inkBorderWidth: "ikw",
     vts: 'vts',
     lineRect:"l",
     lineStyle:"le",
     rotate: "r",
     pdf:"pdf",
     del:"del",
     icon:"stamp_ic",
     dynamic:"dyna",
     dyflag :"df",
     dyContents :"dc",
     rectDiffer: "rd",
     freeCoordinatesLine: "ftcl",
     //redact
     overlayCode:"oc",
     overlayText:"ot",
     areahi: "areahi",
Type
Promise
Example
WebPDF.ViewerInstance.exportAnnotsToJson().then(function(arr){console.log(arr)})
         console result:
         [
         {
             "number": 0,
             "annots": [
                 {
                     "Quad": [
                         57.75,
                         615.28,
                         289.5,
                         615.28,
                         57.75,
                         602.82,
                         289.5,
                         602.82,
                         57.75,
                         602.53,
                         230.71,
                         602.53,
                         57.75,
                         590.08,
                         230.71,
                         590.08
                     ],
                     "bs": 0,
                     "c": "",
                     "ca": 1,
                     "cd": "1384916293",
                     "cl": "#ffed00",
                     "f": 4,
                     "md": "1384916293",
                     "n": "bdf5db1c-cd19-4421-a70b-e28babf3f047",
                     "pop": {
                         "f": 28,
                         "md": "1384887493",
                         "n": "1e547ca0-407d-489e-9da3-15bc8257520c",
                         "op": 0,
                         "rc": [
                             458,
                             615,
                             638,
                             495
                         ]
                     },
                     "r": 0,
                     "rc": [
                         57.75,
                         615.28,
                         289.5,
                         590.08
                     ],
                     "subj": "Highlight",
                     "subty": "Highlight",
                     "tit": "foxit",
                     "ty": "Markup"
                 },
                 {
                     "bs": 0,
                     "c": "Butterflies have been admired for centuries for their physical beauty and behavioural display.",
                     "ca": 1,
                     "cd": "1384916316",
                     "cl": "#ffff00",
                     "f": 28,
                     "md": "1385961736",
                     "n": "c97db9f7-5645-4d06-b5f4-6f9bc91231c2",
                     "pop": {
                         "f": 28,
                         "md": "1384887516",
                         "n": "7f53f835-1c8b-4a2e-80c7-992f9469b58b",
                         "op": 1,
                         "rc": [
                             281,
                             606,
                             460,
                             486
                         ]
                     },
                     "r": 0,
                     "rc": [
                         335.69,
                         490.19,
                         355.69,
                         470.19
                     ],
                     "subj": "Note",
                     "subty": "Text",
                     "tit": "foxit",
                     "txtn": "Comment",
                     "ty": "Markup"
                 }
             ]
         }
         ]

<static> exportAnnotsToXFDF()

Export annotations of current document into a XFDF file.

This function supports the following annotation types:
highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea

Example
WebPDF.ViewerInstance.exportAnnotsToXFDF();

<static> exportAnnotsToXFDFStream(callback)

Export annotations of current document into a XFDF Stream.

This function supports the following annotation types:
highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea

Parameters:
Name Type Description
callback function

The callback function to receive FDF stream with Uint8Array type.

Example
WebPDF.ViewerInstance.exportAnnotsToXFDFStream(function(uint8Array) {
        //use uint8Array to do...
    });

<static> exportDocument(fileName)

Export current document to local browsers.

Parameters:
Name Type Description
fileName String

The name of the file to be exported. If null, use the default file name.


<static> exportDocumentStream(receiveFunction)

Extract document to stream.

Parameters:
Name Type Description
receiveFunction function

Callback function to store stream after export document.

Example
function getFormXMLBuffer(buffer){
             //the variable which store form xml buffer(Uint8Array, and utf8 encoded).
         }

         WebPDF.ViewerInstance.exportDocumentStream(getFormXMLBuffer);

<static> exportInkSigntoJson()

Export inksign data of current document to JSON data.

Returns:

a promise that resolves to an object with info for ink signature data.

Type
Promise
Example
WebPDF.ViewerInstance.exportInkSigntoJson().then(function(arr){console.log(arr)})
console result:
         [
         {
             "pageIndex": 0,
             "inkSignList": [
                 {
                     "isStraddle": false,
                     "pageIndex": 0,
                     "r": 0,
                     "signer": "signer",
                     "dn": "domain",
                     "reason": "",
                     "location": "",
                     "contact": "contactInfo@email.com",
                     "rc": [
                         83.766,
                         455.25,
                         128.766,
                         447.75
                     ],
                     "hash": 1,
                     "subty": "InkSign",
                     "inkData": {
                         "pencil": [
                             {
                                 "color": 0,
                                 "width": 33.75,
                                 "points": [
                                     [
                                         83.766,
                                         455.25
                                     ],
                                     [
                                         90.094125,
                                         455.25
                                     ],
                                     [
                                         102.750375,
                                         455.25
                                     ],
                                     [
                                         109.0785,
                                         455.25
                                     ],
                                     [
                                         121.73475,
                                         455.25
                                     ]
                                 ]
                             }
                         ],
                         "rect": [
                             379.6875,
                             278.4375,
                             430.3125,
                             278.4375
                         ],
                         "per": 1,
                         "def": 1,
                         "inkSignId": "1528201919"
                     },
                     "n": "71a95299-ff5b-4cce-ab17-7681edc46f82"
                 }
             ]
         }
         ]

<static> fire(type, data)

Fires an event with the given name and data.

Parameters:
Name Type Description
type String

The type of event to fire.

data Object

An object with properties that should end up on the event object for the given event.

Returns:

The event object.

Type
Object

<static> flattenPages(includeCallback, pageRange, flags)

Flatten document annotations and form fields by specified page numbers.

Parameters:
Name Type Description
includeCallback function

The callback function to inform the method whether to include current document modifications or not.
That means if the callback return false, the caller need to save the changes firstly, for else, the method will
contain all unsaved changes in final result file.

pageRange String

The page ranges to be flatten, like '1,2-3,4-5', -1 means to flatten all pages.

flags Number

The flatten options.The value can be one or combination of below definition:

FLATTENFLAG_DISPLAY 0
FLATTENFLAG_PRINT 1
FLATTENFLAG_NOANNOT 2
FLATTENFLAG_NOFORMCONTROL 4
combination: 3 = 1 + 2 = FLATTENFLAG_PRINT + FLATTENFLAG_NOANNOT

Returns:

A Promise object. If the promise resolve success, it will return an buffer for result file.

Example
WebPDF.ViewerInstance.flattenPages(null,'-1',0).then(function (buffer) {
            //call opening file API or save buffer to database
        });

<static> focus()

Focus the viewport so it can be natively scrolled with the keyboard.


<static> getCurPageIndex()

Get the current page index.

Returns:

The Current page index.

Type
Number

<static> getCurToolHandlerName()

Get the current tool handler name.

Returns:

The name of the tool handler.

Type
String

<static> getCurZoomLevel()

Get the current zoom level.

Returns:

The current zoom level value or one of:
WebPDF.ZOOM_FIT_WIDTH = 'FitWidth';
WebPDF.ZOOM_FIT_PAGE = 'FitPage';

Type
Number | String

<static> getFileName()

Get the file name of the current PDF document.

Returns:

The file name of the current PDF document.

Type
String

<static> getMetaData(key)

Get metadata of current PDF document.

Parameters:
Name Type Description
key String

The key value of the metadata, the value can be as follows:
Title,
Author,
Subject,
Keywords,
Creator,
Producer,
CreationDate(reserved),
ModDate(reserved),
Trapped(reserved)

See:
Returns:

metadata value

Type
any

<static> getPageAnnots(pageIndex, callback)

Get the annotation data of specific page in json format.

Parameters:
Name Type Description
pageIndex Number

The specified page index.Page index begin at zero.

callback function

Callback function after getting annotations of page.

Returns:

{
  pageIndex: number,
  annots: [
    {
      name:string,
      type:string,
      getSubType:string,
      title:string,
      flag:number,
      createTime:string,
      modifyTime:string,
      contents:string
    }
  ]
}

Type
null | Object
Example
WebPDF.ViewerInstance.getPageAnnots(0, function(data){....})

<static> getPageCount()

Get the page count of current document.

Returns:

The page count of current document.

Type
Number

<static> getThumbnail_p(pageIndex)

Get the URL of page Thumbnail by the specified page index.

Parameters:
Name Type Description
pageIndex Number

The specified page index.the page index is between minimum and max page.

Returns:

The URL of the page Thumbnail.

Type
String

<static> getUserPermission()

Function defined to get user permission.

Returns:

value of user permission. WebPDF.UserPermission

Type
Number
Example
WebPDF.ViewerInstance.getUserPermission()
return value: -1 Allow all permissions

<static> getViewMode()

Get current view mode.

Returns:

Current view mode. 0 for continuous page mode,2 for single page mode.

Type
Number | *

<static> getZoomLevels()

Get the list of current available zoom levels.

Returns:

The list of zoom levels.

Type
Array.<(Number|String)>

<static> gotoNextPage()

Go to the next page.

Returns:

True if the next page is exists, else return false.

Type
Boolean

<static> gotoNextView()

Go to the next view.


<static> gotoPage(pageIndex [, left] [, top])

Jump to a page by the specified page index and the offset to be scrolled to.

Parameters:
Name Type Argument Default Description
pageIndex Number

The specified page index.

left Number <optional>
0

The left offset that the viewer scrolls to in the device coordinates

top Number <optional>
0

The top offset that the viewer scrolls to in the device coordinates

Returns:

True if jump to the specified page successful, otherwise, returns false.

Type
Boolean

<static> gotoPageByDestination(destination)

Jump to a page by the specified destination.

Parameters:
Name Type Description
destination WebPDF.PDFDestination

The specified destination object.

Returns:

True if jump to the specified destination, else return false.

Type
Boolean
Example
WebPDF.ViewerInstance.gotoPageByDestination(new WebPDF.PDFDestination({p:0,l:0,t:100}));

<static> gotoPrevPage()

Go to the previous page.

Returns:

True if the previous page is exist, false for else..

Type
Boolean

<static> gotoPrevView()

Go to the previous view.


<static> hasForm()

Detect whether the document has form fields.

Deprecated:
  • move to FormPlugin
Returns:

True if there is a form field, otherwise, return false.

Type
Boolean

<static> hideAllAnnots()

Hide all current annotations.

Example
WebPDF.ViewerInstance.hideAllAnnots();

<static> hideAnnots(annots)

Hide annotations.

Parameters:
Name Type Description
annots Array

Annotations list for hide

Example
WebPDF.ViewerInstance.getPageAnnots(index, function(pageAnnotsInfo){
   var  annots = pageAnnotsInfo.annots;
   if(!annots){
       return;
   }
    var  showOrHideAnnots = [];
   for(var i =0 ;i<annots.length;i++) {
       if(annots[i].title == $(_this).val()){
           showOrHideAnnots.push(annots[i]);
       }
   }
  WebPDF.ViewerInstance.hideAnnots(showOrHideAnnots);
});

<static> importAnnotsFromFDF(params)

Import annotations to current document from FDF.

This function support the following annotation types:
highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea
Current support only comments data and not include PDF form data.

Parameters:
Name Type Description
params Object

The JSON object contain three parameters as follow.

Properties
Name Type Description
type String

'fileUrl' for http FDF file and 'fileBuffer' for FDF file stream.

fileUrl String

File url of http FDF file.

fileBuffer Uint8Array

File buffer with the type Uint8Array.

Example
var params = {
        type:'fileUrl',
        fileUrl:'http://localhost:8080/docs/sample/Annot_all.fdf'
    };
    WebPDF.ViewerInstance.importAnnotsFromFDF(params);
    OR:
    var params = {
        type:'fileBuffer',
        fileBuffer:ArrayBuffer
    };
    WebPDF.ViewerInstance.importAnnotsFromFDF(params);

<static> importAnnotsFromJson(annotsJson)

Import annotation to current document from JSON data.

This function support the following annotation types: highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea
Current support only comments data and not include PDF form data.

Parameters:
Name Type Description
annotsJson Array.<Object>

The annotations JSON object.

annotsJson[].number number

page index

annotsJson[].annots Array.<Object>

annots for page

     The corresponding field of the value
     type: "ty",
     flag: "f",
     rect: "rc",
     content: "c",
     name: "n",
     borderWidth: "bw",
     borderStyle: "bs",
     color: "cl",
     fillColor:"fcl",
     dash:"d",
     highlight: "hl",
     quadPoints: "Quad",
     destinationInfo: "ds",
     openState: "op",
     modifyDate: "md",
     state: "st",
     stateModel: "stm",
     opacity: "ca",
     creationDate: "cd",
     subject: "subj",
     title: "tit",
     popup: "pop",
     replyChain: "rpy",
     stateList: "stat",
     action: "act",
     group: "grp",
     subType: "subty",
     textAnnotName: "txtn",
     ft: "ft",
     defaultAp: "da",
     fontSize: "fs",
     fontColor: "fc",
     fontName: "ftn",
     lineHeight: "lnh",
     fontHeight: "fh",
     textAlign: "q",
     it: "it",
     inkList: "ikl",
     inkColor: "ikc",
     inkBorderWidth: "ikw",
     vts: 'vts',
     lineRect:"l",
     lineStyle:"le",
     rotate: "r",
     pdf:"pdf",
     del:"del",
     icon:"stamp_ic",
     dynamic:"dyna",
     dyflag :"df",
     dyContents :"dc",
     rectDiffer: "rd",
     freeCoordinatesLine: "ftcl",
     //redact
     overlayCode:"oc",
     overlayText:"ot",
     areahi: "areahi",
Example
WebPDF.ViewerInstance.importAnnotsFromJson([
         {
             "number": 0,
             "annots": [
                 {
                     "bs": 0,
                     "c": "Butterflies have been admired for centuries for their physical beauty and behavioural display.",
                     "ca": 1,
                     "cd": "1384916316",
                     "cl": "#ffff00",
                     "f": 28,
                     "md": "1385961736",
                     "n": "c97db9f7-5645-4d06-b5f4-6f9bc91231c2",
                     "pop": {
                         "f": 28,
                         "md": "1384887516",
                         "n": "7f53f835-1c8b-4a2e-80c7-992f9469b58b",
                         "op": 1,
                         "rc": [
                             281,
                             606,
                             460,
                             486
                         ]
                     },
                     "r": 0,
                     "rc": [
                         335.69,
                         490.19,
                         355.69,
                         470.19
                     ],
                     "subj": "Note",
                     "subty": "Text",
                     "tit": "foxit",
                     "txtn": "Comment",
                     "ty": "Markup"
                 }
             ]
         }
         ])

<static> importAnnotsFromXFDF(bufferArray)

Import annotations to current document from XFDF.

This function support the following annotation types:
highlight,strikeout,underline,squiggly,replace,caret,note,typewriter,callout,textbox,
rectangle,polyline,cloud,oval,arrow,polygon,line,pencil,highlightarea
Current support only comments data and not include PDF form data.

Parameters:
Name Type Description
bufferArray Uint8Array

The xfdf buffer array.

Example
var url = 'http://localhost:8080/docs/sample/Annot_all.xfdf';
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.responseType = 'arraybuffer';
    xhr.send();
    xhr.onload = function(e) {
        var responseArray = new Uint8Array(this.response);
        WebPDF.ViewerInstance.importAnnotsFromXFDF(responseArray);
    }

<static> importInkSignFromJson(inkSignData)

Import ink signature to current document from JSON data.

Parameters:
Name Type Description
inkSignData Object

The ink signature JSON object.

Example
WebPDF.ViewerInstance.importInkSignFromJson([
         {
             "pageIndex": 0,
             "inkSignList": [
                 {
                     "isStraddle": false,
                     "pageIndex": 0,
                     "r": 0,
                     "signer": "signer",
                     "dn": "domain",
                     "reason": "",
                     "location": "",
                     "contact": "contactInfo@email.com",
                     "rc": [
                         83.766,
                         455.25,
                         128.766,
                         447.75
                     ],
                     "hash": 1,
                     "subty": "InkSign",
                     "inkData": {
                         "pencil": [
                             {
                                 "color": 0,
                                 "width": 33.75,
                                 "points": [
                                     [
                                         83.766,
                                         455.25
                                     ],
                                     [
                                         90.094125,
                                         455.25
                                     ],
                                     [
                                         102.750375,
                                         455.25
                                     ],
                                     [
                                         109.0785,
                                         455.25
                                     ],
                                     [
                                         121.73475,
                                         455.25
                                     ]
                                 ]
                             }
                         ],
                         "rect": [
                             379.6875,
                             278.4375,
                             430.3125,
                             278.4375
                         ],
                         "per": 1,
                         "def": 1,
                         "inkSignId": "1528201919"
                     },
                     "n": "71a95299-ff5b-4cce-ab17-7681edc46f82"
                 }
             ]
         }
         ])

<static> insertPagesFromSteam(fileStream, password, pageRanges, insertPos, fileName)

Import pages from PDF Stream to current document.

Parameters:
Name Type Description
fileStream Uint8Array

The PDF file stream of PDF.

password String

The password of the file related above.

pageRanges String

The page ranges to insert, like '1,2-3,4-5', '-1' means insert all pages.

insertPos Number

The page number before which to insert the pages. 0 means insert at the front and -1 mean insert at the end.

fileName String

The fileName of the output file by merging.

Returns:

A Promise object.


<static> isDocModified()

Check whether current document is modified.

Returns:

True if current document is modified, otherwise, return false.

Type
Boolean

<static> isFitPage()

Check whether the current zoom level is WebPDF.ZOOM_FIT_PAGE.

Returns:

True if the current zoom level is WebPDF.ZOOM_FIT_PAGE, otherwise, return false.

Type
Boolean

<static> isFitWidth()

Check whether the current zoom level is WebPDF.ZOOM_FIT_WIDTH.

Returns:

True if the current zoom level is WebPDF.ZOOM_FIT_WIDTH, otherwise, return false.

Type
Boolean

<static> isJREngineReady()

Check whether Javascript engine is ready.

Returns:

True if the engine is ready, false for else.

Type
Boolean

<static> off(type [, handler])

Removes an event handler from a given event. If the handler is not provided, remove all handlers of the given type.

Parameters:
Name Type Argument Description
type String

The name of the event to remove from.

handler function <optional>

The function handler that needs to be removed.

Returns:

Current viewer instance.

Type
WebPDF.ViewerInstance

<static> on(type, handler)

Adds a new event handler for a particular type of event.

Parameters:
Name Type Description
type String

The name of the event to listen for.

handler function

The function to call when the event occurs.

Returns:

Current viewer instance.

Type
WebPDF.Viewer

<static> openFileByStream(fileBuffer, fileId, fileName)

Open PDF file from file stream.

Parameters:
Name Type Description
fileBuffer Uint8Array

The file stream with Uint8Array type.

fileId String

The file ID, maybe file md5 or other unique identification.

fileName String

The file name of PDF.

Example
var url = 'http://localhost:8080/doc/sample/1.pdf';
      var xhr = new XMLHttpRequest();
      xhr.open('GET', url, true);
      xhr.responseType = 'arraybuffer';
      xhr.send();
      xhr.onload = function(e) {
          var responseArray = new Uint8Array(this.response);
          var fileId = "Wed, 29 Dec 2010 09:31:20 GMT";
          WebPDF.ViewerInstance.openFileByStream(responseArray, fileId, "1.pdf");
      }

<static> openFileByUri(params)

Open PDF file by url.

Parameters:
Name Type Description
params Object

The option parameters for open file.

Properties
Name Type Description
url string

the file url

fileId string

the unique identification of file.

isAsyncMode boolean

use the async mode to open the large file, it will improve speed and performance when the PDF file is linearized.

fileSize string

the file size. Required if isAsyncMode is true.

fileName string

the file name. Required if the url is not suffixed by '.pdf'


<static> print()

Do the print process, to open the print dialog.

Returns:

True if the Print dialog is opened, otherwise, return false. One special case is the print to be disabled,return undefined

Type
Boolean | undefined

<static> redo()

Redo the operation (currently this function only supports annotations).

Returns:

None


<static> rotate(direction)

Rotate current doc view.

Parameters:
Name Type Description
direction String

The rotation value to rotate the doc view in 90 degrees clockwise or counterclockwise.
The value can be set as one of the following:
WebPDF.ROTATE_LEFT = 'left';
WebPDF.ROTATE_RIGHT = 'right';

Returns:

True if rotate success, false for else.

Type
Boolean

<static> searchText(textToSearch, direction)

Search text.

Parameters:
Name Type Description
textToSearch String

Text to search, the textToSearch ignore case.

direction number

Direction to search, use one of:
WebPDF.SearchDirection.Up = 0
WebPDF.SearchDirection.Down = 1

Returns:

True if search successful, otherwise, return false.

Type
Boolean

<static> setCurrentToolByName(toolName)

Set the current tool by its name.

Parameters:
Name Type Description
toolName String

The tool name will be set to one of following:
WebPDF.Tools.TOOL_NAME_HAND
WebPDF.Tools.TOOL_NAME_PAGETEXT
WebPDF.Tools.TOOL_NAME_PINTOOL
WebPDF.Tools.TOOL_NAME_SELANNOT
WebPDF.Tools.TOOL_NAME_TEXTANNOT
WebPDF.Tools.TOOL_NAME_TYPERWRITER
WebPDF.Tools.TOOL_NAME_TEXTBOX
WebPDF.Tools.TOOL_NAME_CALLOUT
WebPDF.Tools.TOOL_NAME_IMAGE
WebPDF.Tools.TOOL_NAME_STAMP
WebPDF.Tools.TOOL_NAME_DRAWING_RECTANGLE
WebPDF.Tools.TOOL_NAME_DRAWING_CIRCLE
WebPDF.Tools.TOOL_NAME_DRAWING_SQUARE
WebPDF.Tools.TOOL_NAME_DRAWING_LINE
WebPDF.Tools.TOOL_NAME_DRAWING_LINEARROW
WebPDF.Tools.TOOL_NAME_DRAWING_CLOUD
WebPDF.Tools.TOOL_NAME_DRAWING_POLYGON
WebPDF.Tools.TOOL_NAME_DRAWING_POLYLINE
WebPDF.Tools.TOOL_NAME_DRAWING_DISTANCE
WebPDF.Tools.TOOL_NAME_MARK
WebPDF.Tools.TOOL_NAME_MARK_APPLY
WebPDF.Tools.TOOL_NAME_COMMENT_HIGHLIGHT
WebPDF.Tools.TOOL_NAME_COMMENT_UNDERLINE
WebPDF.Tools.TOOL_NAME_COMMENT_SQUIGGLY
WebPDF.Tools.TOOL_NAME_COMMENT_STRIKEOUT
WebPDF.Tools.TOOL_NAME_COMMENT_REPLACE
WebPDF.Tools.TOOL_NAME_COMMENT_CARET
WebPDF.Tools.TOOL_NAME_COMMENT_HIGHLIGHT_AREA
WebPDF.Tools.TOOL_NAME_INKANNOT
WebPDF.Tools.TOOL_NAME_INKSIGN
WebPDF.Tools.TOOL_NAME_SELECTTEXT
WebPDF.Tools.TOOL_NAME_HAND
WebPDF.Tools.TOOL_NAME_PAGETEXT
WebPDF.Tools.TOOL_NAME_PINTOOL
WebPDF.Tools.TOOL_NAME_SELANNOT
WebPDF.Tools.TOOL_NAME_TEXTANNOT
WebPDF.Tools.TOOL_NAME_TYPERWRITER
WebPDF.Tools.TOOL_NAME_TEXTBOX
WebPDF.Tools.TOOL_NAME_CALLOUT
WebPDF.Tools.TOOL_NAME_IMAGE
WebPDF.Tools.TOOL_NAME_STAMP
WebPDF.Tools.TOOL_NAME_DRAWING_RECTANGLE
WebPDF.Tools.TOOL_NAME_DRAWING_CIRCLE
WebPDF.Tools.TOOL_NAME_DRAWING_SQUARE
WebPDF.Tools.TOOL_NAME_DRAWING_LINE
WebPDF.Tools.TOOL_NAME_DRAWING_LINEARROW
WebPDF.Tools.TOOL_NAME_DRAWING_CLOUD
WebPDF.Tools.TOOL_NAME_DRAWING_POLYGON
WebPDF.Tools.TOOL_NAME_DRAWING_POLYLINE
WebPDF.Tools.TOOL_NAME_DRAWING_DISTANCE
WebPDF.Tools.TOOL_NAME_MARK
WebPDF.Tools.TOOL_NAME_MARK_APPLY
WebPDF.Tools.TOOL_NAME_COMMENT_HIGHLIGHT
WebPDF.Tools.TOOL_NAME_COMMENT_UNDERLINE
WebPDF.Tools.TOOL_NAME_COMMENT_SQUIGGLY
WebPDF.Tools.TOOL_NAME_COMMENT_STRIKEOUT
WebPDF.Tools.TOOL_NAME_COMMENT_REPLACE
WebPDF.Tools.TOOL_NAME_COMMENT_CARET
WebPDF.Tools.TOOL_NAME_COMMENT_HIGHLIGHT_AREA
WebPDF.Tools.TOOL_NAME_INKANNOT
WebPDF.Tools.TOOL_NAME_NORMALSIG
WebPDF.Tools.TOOL_NAME_CROSSPAGESIG
WebPDF.Tools.TOOL_NAME_INKSIGN
WebPDF.Tools.TOOL_NAME_SELECTTEXT

Returns:

True if set current tool successful, else return false.

Type
Boolean

<static> setLayoutShowMode(mode)

Change the page layout mode of the viewer.

Parameters:
Name Type Description
mode Number

The page layout mode will be set to one of the following: WebPDF.PDFView.RD_BRMODE_CONTINUOUS
WebPDF.PDFView.RD_BRMODE_SINGLE_PAGE


<static> setMetaData(key, value)

Set metadata of current PDF document;

Parameters:
Name Type Description
key String

The key value of the metadata, the value can be as follows:
Title,
Author,
Subject,
Keywords,
Creator,
Producer,
CreationDate(reserved),
ModDate(reserved),
Trapped(reserved)

value String

The value to be set as metadata.

Returns:

resolved if set successful, rejected for else.

Type
Promise

<static> setModifyState(flag)

Set the modified state of the current document.

Parameters:
Name Type Description
flag Boolean

document modified state.


<static> setUserPermission(permission)

Function defined to set user's permission.

Parameters:
Name Type Description
permission Number

value of user permission.WebPDF.UserPermission

Example
Set only read and download permissions
WebPDF.ViewerInstance.setUserPermission(WebPDF.UserPermission.DOCUMENT_VIEW + WebPDF.UserPermission.DOWNLOAD)

<static> showAllAnnots()

Show all current annotations.

Example
WebPDF.ViewerInstance.showAllAnnots();

<static> showAnnots(annots)

Show annotations.

Parameters:
Name Type Description
annots Array.<object>

Annotations list for show

annots[].name string

Annotations name.

Example
WebPDF.ViewerInstance.showAnnots([
            {name: 'bdf5db1c-cd19-4421-a70b-e28babf3f047'}
         ]);

<static> showFullPage()

Set to display the specified page in full screen mode.

Returns:

True if show full screen success, false for else.

Type
Boolean

<static> undo()

Undo the operation(currently only annotations are supported).

Returns:

None


<static> updateLayout(width, height)

Update the layout of current viewer instance.

Parameters:
Name Type Description
width Number

New width of viewport.

height Number

New height of viewport.


<static> zoomTo(val)

Zoom to the given value.

Parameters:
Name Type Description
val float | String

The given value or the one of the following:
WebPDF.ZOOM_FIT_WIDTH = 'FitWidth';
WebPDF.ZOOM_IN = 'in';
WebPDF.ZOOM_OUT = 'out';
WebPDF.ZOOM_FIT_PAGE = 'FitPage';
If val is a number,It must be within the scope of 0.1 to 2

Returns:

If zoom is successful return true, otherwise, return false

Type
Boolean