new DocumentViewer()
Constructs a new empty Document, representing a document with individual pages that can be displayed on screen and printed.
Extends
Members
-
currentPageNumber
-
The current page number being displayed.
-
isDocumentModified
-
Whether the document has been modified.
-
pagesCount
-
The number of pages in the document.
-
pagesRotation
-
The rotation of the pages in the document.
-
scale
-
The current scale of the document.
Methods
-
addAnnotations(annotation)
-
Add annotations to the document.
Parameters:
Name Type Description annotationobject The object containing the annotation to add.
-
addEvent(eventName, listener [, options])
-
Parameters:
Name Type Argument Description eventNamestring The name of the event to listen for.
listenerfunction The function to call when the event is dispatched.
optionsobject <optional>
The options for the event listener.
Properties
Name Type Description onceboolean Whether the listener should only be called once.
- Inherited From:
-
clearSearchResults()
-
Clear the search results in the document.
-
copyPages(pagesIndexToCopy)
-
Copy pages in the document.
Parameters:
Name Type Description pagesIndexToCopyArray.<number> The index of the pages to copy.
-
dispatch(eventName, data)
-
Parameters:
Name Type Description eventNamestring The name of the event to dispatch.
data* The data to pass to the event listeners.
- Inherited From:
-
download()
-
Download the document as an ArrayBuffer.
Returns:
- Type
- Promise.<ArrayBuffer>
-
exportFormXfdf()
-
Export the form annotations in the document as XFDF.
Returns:
The XFDF string of the exported form annotations.
- Type
- Promise.<string>
-
exportPDF(saveAs)
-
Export the document as a PDF.
Parameters:
Name Type Description saveAsboolean Whether to save as the document.
Returns:
The ArrayBuffer of the exported PDF.
- Type
- Promise.<ArrayBuffer>
-
exportXfdf()
-
Export the annotations in the document as XFDF.
Returns:
The XFDF string of the exported annotations.
- Type
- Promise.<string>
-
extractPages(pagesIndexToExtract)
-
Extract pages from the document.
Parameters:
Name Type Description pagesIndexToExtractArray.<(number|string)> The index of the pages to extract.
Returns:
The ArrayBuffer of the extracted pages.
- Type
- Promise.<ArrayBuffer>
-
flattenPdf()
-
Flatten the annotations in the document.
Returns:
The ArrayBuffer of the flattened PDF.
- Type
- Promise.<ArrayBuffer>
-
getActiveSearchResult()
-
Get the active search result in the document.
Returns:
The active search result object.
- Type
- object
-
getAnnotationHistoryManager()
-
Get the AnnotationHistoryManager for the document.
Returns:
The AnnotationHistoryManager for the document.
-
getAnnotationManager()
-
Get the AnnotationManager for the document.
Returns:
The AnnotationManager for the document.
- Type
- AnnotationManager
-
getBookmarks()
-
Get the bookmarks in the document.
Returns:
The bookmarks in the document.
- Type
- Array.<object>
-
getPageHeight(pageNumber)
-
Get the height of a specified page in the document.
Parameters:
Name Type Description pageNumbernumber The page number to get the height of.
Returns:
The height of the page
- Type
- number
-
getPageSearchResults(pageNumber)
-
Get the search results on a specified page in the document.
Parameters:
Name Type Description pageNumbernumber The page number to get the search results from.
Returns:
The search results on the specified page.
- Type
- Array.<object>
-
getPageTextContent(pageNumber)
-
Get the text content of a specified page in the document.
Parameters:
Name Type Description pageNumbernumber The page number to get the text content from.
Returns:
The text content of the specified page.
- Type
- Promise.<string>
-
getPageWidth(pageNumber)
-
Get the width of a specified page in the document.
Parameters:
Name Type Description pageNumbernumber The page number to get the width of.
Returns:
The width of the page
- Type
- number
-
getScrollViewElement()
-
Get the scroll view element of the web viewer.
Returns:
The scroll view element.
- Type
- HTMLElement
-
getSelectedPage(mousePoint1, mousePoint2)
-
Get the page number of the page that contains the specified points.
Parameters:
Name Type Description mousePoint1object The first point.
Properties
Name Type Description xnumber The x coordinate of the first point.
ynumber The y coordinate of the first point.
mousePoint2object The second point.
Properties
Name Type Description xnumber The x coordinate of the second point.
ynumber The y coordinate of the second point.
Returns:
The first selected page and last selected page.
- Type
- object
-
getSelectedText()
-
Get the selected text in the document.
Returns:
The selected text.
- Type
- string
-
getSelectedTextQuads()
-
Get the quads of the selected text in the document.
Returns:
The quads of the selected text.
- Type
- Array.<Object>
-
getViewerElement()
-
Get the viewer element of the web viewer.
Returns:
The viewer element.
- Type
- HTMLElement
-
getWebFontNameList()
-
Get the list of web font names imported in the document.
Returns:
The list of web font names.
- Type
- Promise.<Array.<string>>
-
importAnnotations(annotations)
-
Import from annotations into the document.
Parameters:
Name Type Description annotationsstring | File The XFDF string or ArrayBuffer to import.
-
importFormAnnotations(formAnnotations)
-
Import form annotations into the document.
Parameters:
Name Type Description formAnnotationsstring | File The XFDF string or ArrayBuffer to import.
-
insertBlankPage(pageIndex, width, height)
-
Insert a blank page into the document.
Parameters:
Name Type Description pageIndexnumber The index to insert the blank page at.
widthnumber The width of the blank page.
heightnumber The height of the blank page.
-
insertPages(file, pageIndexToInsert, pagesIndexToInsert)
-
Insert pages into the document.
Parameters:
Name Type Description fileFile The file to insert.
pageIndexToInsertnumber The index to insert the pages at.
pagesIndexToInsertArray.<(number|string)> The index of the pages to insert.
-
jumpToAnnotation(annotation)
-
Jump to the specified annotation in the document.
Parameters:
Name Type Description annotationAnnotation The annotation to jump to.
-
movePages(pagesIndexToMove, targetPageIndex)
-
Move pages in the document.
Parameters:
Name Type Description pagesIndexToMovestring The index of the pages to move.
targetPageIndexnumber The index to move the pages to.
-
nextPage()
-
Display the next page in the web viewer.
-
pageNumberChanged(pageNumber)
-
Display the specified page in the web viewer.
Parameters:
Name Type Description pageNumberstring The page number to display.
-
pageToWindow(pagePoint, pageNumber)
-
Convert a point from page coordinates to window coordinates.
Parameters:
Name Type Description pagePointobject The point to convert.
Properties
Name Type Description xnumber The x coordinate of the point.
ynumber The y coordinate of the point.
pageNumbernumber The page number of the point.
Returns:
The converted point.
- Type
- object
-
previousPage()
-
Display the previous page in the web viewer.
-
removeEvent(eventName, listener)
-
Parameters:
Name Type Description eventNamestring The name of the event to remove listening for.
listenerfunction The function to remove from the event listeners.
- Inherited From:
-
removePages(pagesIndexToDelete)
-
Remove pages from the document.
Parameters:
Name Type Description pagesIndexToDeleteArray.<number> The index of the pages to remove.
-
removePassword()
-
Remove the password from the document.
-
requestFullScreenMode()
-
Request full screen mode for the web viewer.
-
rotatePages(pagesIndexToRotate, rotation)
-
Rotate pages in the document.
Parameters:
Name Type Description pagesIndexToRotateArray.<number> The index of the pages to rotate.
rotationnumber The rotation to apply to the pages.
-
scrollTo(position)
-
Scroll the web viewer to the specified position.
Parameters:
Name Type Description positionobject The position to scroll to.
Properties
Name Type Description leftnumber The left coordinate to scroll to.
topnumber The top coordinate to scroll to.
-
scrollToPercent(position)
-
Scroll the web viewer to the specified percentage position.
Parameters:
Name Type Description positionobject The percentage position to scroll to.
Properties
Name Type Description leftnumber The horizontal percentage to scroll to (0 to 1).
topnumber The vertical percentage to scroll to (0 to 1).
-
search(text)
-
Searche the document for the specified text.
Parameters:
Name Type Description textstring The Searched Content.
Returns:
The search result object.
- Type
- Promise.<object>
-
searchInPage(text, pageNumber)
-
Search the specified page in the document for the specified text.
Parameters:
Name Type Description textstring The Searched Content.
pageNumbernumber The page number to search in.
Returns:
The search result object.
- Type
- Promise.<object>
-
setActiveSearchResult(searchResult)
-
Set the active search result in the document.
Parameters:
Name Type Description searchResultobject The search result to set as active.
-
setCurrentPage(pageNumber)
-
Set the current page in the web viewer.
Parameters:
Name Type Description pageNumbernumber The page number to set as current.
-
setErrorCallback(callback)
-
Set the error callback for the document.
Parameters:
Name Type Description callbackfunction The callback function to set.
Returns:
The error object.
- Type
- object
-
setPassword(password)
-
Set the password for the document.
Parameters:
Name Type Description passwordstring The password to set.
-
setSearchHighlightColors(colors)
-
Set the highlight colors for search results in the document.
Parameters:
Name Type Description colorsobject The colors to set for highlighting search results.
Properties
Name Type Argument Description searchResultstring <optional>
The color to highlight the search results.
activeSearchResultstring <optional>
The color to highlight the active search result.
-
setTool(toolName)
-
Set the current tool in the web viewer.
Parameters:
Name Type Description toolName'addText' | 'addImage' | 'cropPage' | 'redaction' | 'remove' | 'signatureFields' | 'addDigitalSign' | 'addElectronicSign' | 'pan' | 'selectText' | 'text' | 'ink' | 'highlight' | 'underline' | 'strikeout' | 'squiggly' | 'circle' | 'arc' | 'square' | 'polygon' | 'cloudy' | 'polyline' | 'arrow' | 'line' | 'freetext' | 'callout' | 'image' | 'link' | 'textfield' | 'checkbox' | 'radiobutton' | 'listbox' | 'combobox' | 'pushbutton' | 'lineMeasurement' | 'polylineMeasurement' | 'curveMeasurement' | 'arcMeasurement' | 'circleMeasurement' | 'rectangleMeasurement' | 'polygonMeasurement' The name of the tool to set.
-
webViewerScaleChanged(scale)
-
Change the scale of the web viewer.
Parameters:
Name Type Description scalenumber The scale to change to.
-
webViewerSwitchScrollMode(mode)
-
Switche the scroll mode of the web viewer.
Parameters:
Name Type Description mode0 | 1 Scroll Mode Parameter, Vertical Mode: 0, Horizontal Mode: 1
-
webViewerSwitchSpreadMode(mode)
-
Switche the display mode of the web viewer.
Parameters:
Name Type Description mode0 | 1 | 2 Display Mode Parameter, Single Mode: 0, Two-up Mode: 1, Cover Mode: 2
-
windowToPage(windowPoint, pageNumber)
-
Convert a point from window coordinates to page coordinates.
Parameters:
Name Type Description windowPointobject The point to convert.
Properties
Name Type Description xnumber The x coordinate of the point.
ynumber The y coordinate of the point.
pageNumbernumber The page number of the point.
Returns:
The converted point.
- Type
- object
-
zoomIn()
-
Zoom in the web viewer.
-
zoomOut()
-
Zoom out the web viewer.
Events
-
annotationChanged
-
Triggered when an annotation is added, modified, or deleted.
Properties:
Name Type Description actionstring The action that was changed. Can be "add", "modify", or "delete".
annotationsArray.<Annotation> The annotations that were changed.
-
annotationDeselected
-
Triggered when an annotation is deselected.
Properties:
Name Type Description annotationAnnotation The annotation that was deselected.
-
annotationSelected
-
Triggered when an annotation is selected.
Properties:
Name Type Description annotationAnnotation The annotation that was selected.
-
click
-
Triggered when the document viewer is clicked.
Properties:
Name Type Description eventobject The click event object.
-
contentBoxDeselected
-
Triggered when a content box is deselected.
-
contentBoxSelected
-
Triggered when a content box is selected.
Properties:
Name Type Description dataobject The data object.
Properties
Name Type Description type'text' | 'image' The type of content box selected.
pageNumberobject The page number of the content box.
-
dblclick
-
Triggered when the document viewer is double clicked.
Properties:
Name Type Description eventobject The double click event object.
-
deleteReply
-
Triggered when a reply to an annotation is deleted.
Properties:
Name Type Description annotationAnnotation The reply annotation that was deleted.
-
documentloaded
-
Triggered when a document is loaded.
-
mouseMove
-
Triggered when the mouse is moved over the document viewer.
Properties:
Name Type Description eventobject The mouse move event object.
-
pageCropped
-
Triggered when a page is cropped.
Properties:
Name Type Description dataobject The data object.
Properties
Name Type Description pageNumbernumber The page number that was cropped.
rectobject The crop box of the page.
-
pageNumberUpdated
-
Triggered when the current page number is updated.
Properties:
Name Type Description pageNumbernumber The current page number.
-
scalechanging
-
Triggered when the scale is changing.
Properties:
Name Type Description dataobject The data object.
Properties
Name Type Description scalenumber The new scale value.
-
textSelected
-
Triggered when text is selected in the document viewer.
Properties:
Name Type Description dataobject The data object.
Properties
Name Type Description selectedTextstring The selected text.
textRectsArray.<Object> The quads of the selected text.
pageNumbernumber The page number of the selected text.
-
toolChanged
-
Triggered when the current tool is changed.
Properties:
Name Type Description toolstring The name of the tool.
-
updateAnnotationPermission
-
Triggered when the permission of an annotation is updated.