new DocumentViewer()
Examples
// 5.1 and after
WebViewer(...)
.then(function(instance) {
var docViewer = instance.docViewer;
// docViewer.someAPI();
});
// 4.0 ~ 5.0
var viewerElement = document.getElementById('viewer');
var viewer = new PDFTron.WebViewer(...);
viewerElement.addEventListener('ready', function() {
var instance = viewer.getInstance();
var docViewer = instance.docViewer;
// docViewer.someAPI();
});
Extends
Members
-
<static> FitMode
-
Contains a list of available fit modes for the DocumentViewer.
Properties:
Name Type Description FitWidthZoom level is constrained such that the current page's width will exactly fill the available space.
FitPageZoom level is constrained such that the current page's width or height will exactly fill the available space.
ZoomZoom level is not constrained.
-
<static> SearchMode
-
Search modes that control how searching is conducted.
Properties:
Name Type Description e_case_sensitivenumber If set, the found text must match the case of the search term.
e_whole_wordnumber If set, the found text must be a whole word (preceeded and followed by a non-alphabetical character, or in the case of a number, a non-numerical character.
e_search_upnumber If set, the document pages will be searched in descending order, from bottom to top.
e_page_stopnumber If set, the search will return with a result code of Page at the end of every page. Useful for updating the UI.
e_highlightnumber If set, the bounding box the found term will be included. Useful for highlighting text and positioning the page.
e_ambient_stringnumber If set, the characters surrounding the found term will be included. This gives context to the search result may be useful when providing a list of search results.
-
<static> SearchResults
-
The code indicating the reason that the search process concluded.
Properties:
Name Type Description ambient_strstring The text surrounding the result string.
result_strstring The found text.
result_str_startnumber The index in ambient string where the result string starts.
result_str_endnumber The index in ambient string where the result string end.
page_numnumber The page number which the search was conducted on.
resultCodenumber The reason the search completed.
quadsObject A list of Quads, representing the bounding box(es) of the found text. Useful for highlighting the text.
Methods
-
clearSearchResults()
-
Clears all search results from the viewer
-
clearSelection()
-
Clears any selected text on the all pages.
-
closeDocument()
-
Reinitializes data and clears the viewer area content.
-
displayAdditionalSearchResult(result)
-
Displays the new search result without clearing previous results
Parameters:
Name Type Description resultObject The result of a search, DocumentViewer.SearchResults. Returned by onSearchCallback in CoreControls.DocumentViewer#textSearchInit.
-
displayBookmark(bookmark)
-
If the boomark is an internal link then it scrolls the viewer so that the position of the bookmark is in the upper-left corner of the viewer. If it's an external URL then it opens the URL.
Parameters:
Name Type Description bookmarkBookmark A bookmark that specifies the location to go to. Returned by CoreControls.Document#getBookmarks.
-
displayFirstPage()
-
Scrolls the viewer so that the upper-left corner of the Document's first page is in the upper-left corner of the viewer.
-
displayLastPage()
-
Scrolls the viewer so that the upper-left corner of the Document's last page is in the upper-left corner of the viewer.
-
displayPageLocation(pageNumber, horizontalPosition, verticalPostion, doNotJumpIfInView)
-
Display the specified page location in the viewer
Parameters:
Name Type Description pageNumberint The page number the location is on
horizontalPositionnumber The horizontal position from the left of the page
verticalPostionnumber The vertical position from the top of the page
doNotJumpIfInViewboolean If true then if the page location is currently in view don't cause the viewer to shift
-
displaySearchResult(result, jump)
-
Scrolls the viewer so that the position of the search result is in the middle of the viewer.
Parameters:
Name Type Description resultObject The result of a search, DocumentViewer.SearchResults. Returned by onSearchCallback in CoreControls.DocumentViewer#textSearchInit.
jumpfunction The callback for navigating to the found result.
-
dispose()
-
Disposes the current document's data
-
drawSelection(pageNumber)
-
Draws the text selection for the specified page. Should be called after calling AnnotationManager's drawAnnotations function if the selection should still be shown.
Parameters:
Name Type Description pageNumbernumber The page number to draw the selection on
-
getAnnotationManager()
-
Returns the AnnotationManager used by this DocumentViewer
Returns:
an instance of AnnotationManager
- Type
- AnnotationManager
-
getAnnotationsLoadedPromise()
-
Gets a promise that resolves when the annotations in the current document have all been loaded
Returns:
Promise that resolves when the annotations in the current document have loaded.
- Type
- Promise
-
getColorSeparationsAtPoint(pageNumber, x, y)
-
Gets the color separation values for the specified point. The x and y values should be in page coordinates.
Parameters:
Name Type Description pageNumbernumber The page number of the point
xnumber The x value of the point
ynumber The y value of the point
Returns:
A list of objects which each have the name of the separation and the saturation percentage of the color at the point [{ name, value }, ...]
- Type
- array
-
getCompleteRotation( [pageNumber])
-
Returns the complete rotation of the page including the document's rotation.
Parameters:
Name Type Argument Description pageNumbernumber <optional>
Optionally pass the page number to get the specific page's rotation
Returns:
The current complete rotation.
-
getCurrentPage()
-
Returns the current page number.
Returns:
The current 1-indexed page number.
- Type
- number
-
getDisplayModeManager()
-
Returns the DisplayModeManager used by this DocumentViewer
Returns:
an instance of DisplayModeManager
- Type
- DisplayModeManager
-
getDocument()
-
Returns the Document that is currently being displayed by the viewer.
Returns:
returns the current document.
-
getFitMode()
-
Returns the current fit mode.
Returns:
The current fit mode.
- Type
- DocumentViewer.FitMode
-
getMargin()
-
Returns a pixel value, representing the left, right, top and bottom margins.
Returns:
The margin value.
- Type
- number
-
getPageCount()
-
Returns the number of pages in a document.
Returns:
The number of the pages in the current document.
- Type
- number
-
getPageHeight(pageIndex)
-
Get the current height of the specified page, taking into account rotation.
Parameters:
Name Type Description pageIndexint The page index
Returns:
The height of the page
- Type
- number
-
getPageRotations()
-
Gets the individual page rotations of the document. Only returns pages that have been rotated individually.
Returns:
An object with keys that are page indexes (0-indexed) and values that are rotation values.
- Type
- object
-
getPageWidth(pageIndex)
-
Get the current width of the specified page, taking into account rotation.
Parameters:
Name Type Description pageIndexint The page index
Returns:
The width of the page
- Type
- number
-
getPageZoom(pageIndex)
-
Get the zoom value for a particular page.
Parameters:
Name Type Description pageIndexint The page index.
-
getRightToLeftPages()
-
Returns the page rendering order.
Returns:
The current page rendering order.
- Type
- boolean
-
getRotation( [pageNumber])
-
Returns the current viewing rotation.
Parameters:
Name Type Argument Description pageNumbernumber <optional>
Optionally pass the page number to get the specific page's rotation
Returns:
The current viewing rotation.
Example
PageRotation.e_0 = 0 (0 degress) <br/> PageRotation.e_90 = 1 (90 degress) <br/> PageRotation.e_180 = 2 (180 degress) <br/> PageRotation.e_270 = 3 (270 degress) <br/>
-
getScrollViewElement()
-
Gets the scrollview element that is being used by DocumentViewer
Returns:
The scrollview DOM element that DocumentViewer appends pages
- Type
- Element
-
getSelectedText( [pageNumber])
-
Returns the text selected by text selection tool or search.
Parameters:
Name Type Argument Description pageNumbernumber <optional>
Optionally pass the 1-indexed page number
Returns:
Selected text.
- Type
- string
-
getSelectedTextQuads( [pageNumber])
-
Returns the quads of the text selected by text selection tool or search.
Parameters:
Name Type Argument Description pageNumbernumber <optional>
Optionally pass the 1-indexed page number
Returns:
Selected text quads.
- Type
- object
-
getTool(Name)
-
Returns a specific tool from the tool mode map.
Parameters:
Name Type Description Namestring of the tool. eg 'AnnotationEdit'
Returns:
The tool mode map object.
- Type
- object
-
getToolMode()
-
Returns the current tool.
Returns:
The current tool.
- Type
- window.Tools
-
getToolModeMap()
-
Returns the tool mode map object.
Returns:
The tool mode map object.
- Type
- object
-
getViewportRegionRect()
-
Returns the current viewport rendering region is viewport rendering is enabled.
Returns:
returns the current viewport rendering region
- Type
- object
-
getZoom()
-
Returns the current zoom level
Returns:
The current zoom level.
- Type
- number
-
loadAsync(partRetriever, options)
-
Initialize the viewer and load a .xod document into the viewer.
Parameters:
Name Type Description partRetrieverHttpPartRetriever | LocalPartRetriever | StreamingPartRetriever An instance of PartRetriever.
optionsobject An object that can contain the following optional parameters
Properties
Name Type Argument Description typestring <optional>
The type of document being loaded. Values are xod, pdf, office, blackbox. Default is xod.
docIdstring <optional>
An optional unique identifier for the document, used for offline mode
onErrorfunction <optional>
A callback of the form function(err) which will be called when a loading error occurs.
workerTransportPromisepromise <optional>
Required for PDF viewing. A promise that will be resolved when a worker transport has been initialized. This can be created by calling CoreControls.initializeWorkerTransport
getPasswordfunction <optional>
An method of the form function(callback) where callback is of the form function(password). getPassword will be called when a password is required to load a PDF document and should call the callback with the retrieved password.
extensionstring <optional>
An field used to specify the type of file being read. This is only relevant for PDF viewing and at the moment only works for certain image formats and .pdf
-
off(eventName [, handler])
-
Remove an event handler
Parameters:
Name Type Argument Description eventNamestring The name of the event to remove the handler for
handlerfunction <optional>
The handler associated with this event to be removed
- Inherited From:
Returns:
Returns the object that 'off' is being called on.
- Type
- object
-
on(eventName, handler)
-
Add an event handler
Parameters:
Name Type Description eventNamestring The name of the event to listen to
handlerfunction The function to be called when the event is triggered
- Inherited From:
Returns:
Returns the object that 'on' is being called on.
- Type
- object
-
one(eventName, handler)
-
Add an event handler that will be removed automatically after being handled the first time
Parameters:
Name Type Description eventNamestring The name of the event to listen to
handlerfunction The function to be called when the event is triggered
- Inherited From:
Returns:
Returns the object that 'one' is being called on.
- Type
- object
-
recalculateLayout(pagesToRecalculate)
-
Request a recalculation of page layout and rerender all pages. For use when modifying the underlying Document without using the provided page modification functions (cropPages, rotatePages...)
Parameters:
Name Type Description pagesToRecalculatearray An array of page numbers (1-indexed) that should be recalculated
-
refreshAll()
-
Invalidates the rendering cache for all pages
-
refreshPage(pageNumber)
-
Invalidates the rendering cache for the specified page
Parameters:
Name Type Description pageNumbernumber The page number of the page (1-indexed)
-
removeContent(removeData, rotationChanged, isZoomChanged)
-
Removes all the page content from the DOM. Also clear the cache if the zoom or rotation has changed.
Parameters:
Name Type Description removeDatabool Whether or not to remove all event handlers and data on the elements
rotationChangedbool isZoomChangedbool -
returnCanvas(pageIndex, canvas)
-
Returns the canvas so that it can be reused. Should be called when the canvas is no longer used by the viewer. Only valid in viewport canvas mode.
Parameters:
Name Type Description pageIndexnumber The page index of the canvas
canvasobject The canvas element to return
-
rotateClockwise( [pageNumber])
-
Rotates all pages in the currently displayed document clockwise by 90 degrees.
Parameters:
Name Type Argument Description pageNumbernumber <optional>
Optionally pass the page number to rotate only a specific page
-
rotateCounterClockwise( [pageNumber])
-
Rotates all pages in the currently displayed document counter-clockwise by 90 degrees.
Parameters:
Name Type Argument Description pageNumbernumber <optional>
Optionally pass the page number to rotate only a specific page
-
scrollViewUpdated()
-
This function must be called after modifying the ScrollView (#DocumentViewer) element's dimensions or properties.
-
select(pt1, pt2)
-
Selects the text content of the document given two page coordinates.
Parameters:
Name Type Description pt1Starting page coordinate. Requires properties x, y and pageIndex.
pt2Ending page coordinate. Requires properties x, y and pageIndex.
-
setActiveSearchResult(result)
-
Sets the active search result, causing it to be displayed as a different color and visible on the screen.
Parameters:
Name Type Description resultObject The result of a search, DocumentViewer.SearchResults. Returned by onSearchCallback in CoreControls.DocumentViewer#textSearchInit.
-
setAnnotationImportOptions(options)
-
Set the options that are used when importing annotations from a document asynchronously. These are the options that will be passed to AnnotationManager.importAnnotationsAsync.
Parameters:
Name Type Description optionsobject The options for importing
Properties
Name Type Description batchSizenumber The number of annotations to import in each batch
batchDelaynumber The amount of time in milliseconds to delay between importing each batch
-
setCurrentPage(pageNumber)
-
Sets the current page. Updates the current page and jumps to it.
Parameters:
Name Type Description pageNumberint The page number to jump to.
-
setFitMode(fitMode)
-
Sets how the document will scale to fit the size of the scrollviewer's viewport. Also re-renders content to the appropriate zoom level. Only renders if a document has been loaded.
Parameters:
Name Type Description fitModeDocumentViewer.FitMode -
setInternalAnnotationsTransform(handler(annotationData,callback))
-
Allows you to transform (or replace) the internal annotations of the document. Note that to handle annotations using PDFNetJS without useDownloader: false you will also want to call setPagesUpdatedInternalAnnotationsTransform
Parameters:
Name Type Description handler(annotationData,callback)function A handler function that takes annotation data and a callback that is called when the transformed data is ready
-
setLoadAnnotationsFromVisiblePages(val)
-
Sets whether annotations should only be loaded from the visible pages and removed when a page is no longer visible. Note that when enabling this option only annotations on the visible pages will be exported or included in the downloaded document
Parameters:
Name Type Description valboolean Whether the option should be enabled or not
-
setMargin(margin)
-
Set the pixel value to use for the left, right, top and bottom margins.
Parameters:
Name Type Description marginnumber The margin value to set.
-
setOptions(options)
-
Sets specific DocumentViewer options.
Parameters:
Name Type Description optionsobject An options object, currently valid options are enableAnnotations and annotMode
-
setPageRotations(rotations)
-
Sets the individual page rotations of multiple pages at once. Pages that aren't specified will use the default document rotation.
Parameters:
Name Type Description rotationsobject An object with keys that are page indexes (0-indexed) and values that are rotation values. Rotations should be specified as {CoreControls.PageRotation}s
-
setPagesPerCanvas(numPages, isCover)
-
Sets the number of pages that will be visible on each canvas. Only valid in viewport canvas mode.
Parameters:
Name Type Description numPagesnumber isCoverboolean -
setPagesUpdatedInternalAnnotationsTransform(handler(annotationData,pageList,callback))
-
Allows you to transform (or replace) the internal annotations of the document when pages receive an update event. This includes when using PDFNetJS with downloader enabled (default) on a linearized document. For completeness you will also want to call setInternalAnnotationsTransform.
Parameters:
Name Type Description handler(annotationData,pageList,callback)function A handler function that takes annotation data, an array of updated page numbers and a callback that is called when the transformed data is ready
-
setPageVisibilityCallback(callback(pageNumber))
-
Sets the callback function that will be called when a page is newly visible in the viewer.
Parameters:
Name Type Description callback(pageNumber)function A function that takes in a page number indicating the page that is now visible
-
setPageZoom(pageIndex, zoom)
-
Sets the zoom for a particular page. Should be followed by a call to updateView to actually render the page.
Parameters:
Name Type Description pageIndexint The page index.
zoomfloat Zoom value for page.
-
setRightToLeftPages(rightToLeftPages)
-
Sets the page rendering order.
Parameters:
Name Type Description rightToLeftPagesboolean Whether the new page rendering order should be right to left or not.
-
setRotation(pageRotation [, pageNumber])
-
Sets the current viewing rotation.
Parameters:
Name Type Argument Description pageRotationCoreControls.PageRotation desired viewing rotation.
pageNumbernumber <optional>
Optionally pass the page number to set the specific page's rotation
-
setScrollViewElement(scrollViewElement)
-
Sets the scrollview element that DocumentViewer will append rendered pages to.
Parameters:
Name Type Description scrollViewElementElement The scrollview DOM element to be used
-
setSearchHighlightColors(colorOptions)
-
Sets the color to use when highlighting text from searching.
Parameters:
Name Type Description colorOptionsobject An object with searchResult or activeSearchResult properties set as a color eg 'rgba(0, 0, 200, 0.5)'
Example
docViewer.setSearchHighlightColors({ searchResult: 'rgba(255, 0, 0, 0.5)', activeSearchResult: 'rgba(0, 255, 0, 0.5)' }); -
setTextHighlightColor(color)
-
Sets the color to use when highlighting text from text selection.
Parameters:
Name Type Description colorstring The color to set. eg 'rgba(0, 0, 200, 0.3)'
-
setToolMode(tool)
-
Sets the tool mode. Also removes selection caused by text selection or search.
Parameters:
Name Type Description toolTools.Tool An instance of the toolmode
-
setWatermark(options)
-
Sets watermark to be added to documents. Instead of an options object you can also pass a Promise that resolves with the watermark options object. If the document hasn't been loaded yet then DocumentViewer will wait to finish loading it until the watermark options are ready.
Parameters:
Name Type Description optionsobject Object that contains style/content of the watermark
Example
docViewer.setWatermark({ diagonal: { text: (string), fontSize: (number || 20), fontFamily: (string || 'sans-serif'), color: (string || 'black'), opacity: (number || 100) }, header: { left: (string), center: (string), right: (string), fontSize: (number || 20), fontFamily: (string || 'sans-serif'), color: (string || 'black'), opacity: (number || 100) }, footer: { left: (string) center: (string), right: (string), fontSize: (number || 20), fontFamily: (string || 'sans-serif'), color: (string || 'black'), opacity: (number || 100), }, custom: (function(ctx, pageIndex, pageWidth, pageHeight)), shouldDrawOverAnnotations: (boolean || false) }); -
snapToNearest(pageNumber, x, y)
-
Returns the path coordinate within the page that is closest to the queried point.
Parameters:
Name Type Description pageNumbernumber The page number the point is on
xnumber The x position to calculate the snap point from
ynumber The y position to calculate the snap point from
Returns:
A promise that resolves to an object with x and y properties representing the nearest path point
- Type
- Promise
-
stopPageRender(pageIndex)
-
Stops the rendering of the specified page.
Parameters:
Name Type Description pageIndexnumber The index of the page who's rendering should be stopped.
-
textSearchInit(pattern, mode, fullSearch, onSearchCallback(result))
-
Searches for a particular text string on the currently displayed Document, starting on the current page.
Parameters:
Name Type Description patternstring The text to search for.
modeDocumentViewer.SearchMode The options for search, controlling options such as case sensitivity and search direction.
fullSearchboolean If true, a search of the entire document will be performed. Otherwise, a single search will be perfomed.
onSearchCallback(result)function The callback function to call when the search completes. The search may complete when the search term is found, when the entire document has been searched, and, depending on the search options, at the end of every page. Parameter result: DocumentViewer.SearchResults.
-
trigger(eventName, eventParams)
-
Trigger an event
Parameters:
Name Type Description eventNamestring The name of the event to trigger
eventParamsarray Parameters associated with the event
- Inherited From:
Returns:
Returns the object that 'trigger' is being called on.
- Type
- object
Example
annotManager.trigger('annotationChanged', [[annotation], 'modify']); -
updateLinks(pageIndex)
-
Updates old xod (version <= 1.2) link annotations in the annotation manager
Parameters:
Name Type Description pageIndexnumber The zero-indexed page number to update
-
updateView(visiblePages, currentPageIndex)
-
Removes previously drawn pages that are no longer visible and draws pages that are visible and have not been drawn. If visiblePages are provided then those pages are rendered otherwise visiblePages are calculated depending on where the DIV elements for the pages are located.
Parameters:
Name Type Description visiblePagesObject An array of integers representing the pages to render.
currentPageIndexnumber The index of the page that is currently visible in the viewer.
-
updateVisiblePages(visiblePages)
-
Notifies the document viewer that the visible pages have changed but does not draw any pages.
Parameters:
Name Type Description visiblePages -
zoomTo(zoom [, x] [, y])
-
Adjusts the viewer's zoom factor, and positions the point (x,y) at the upper left corner of the viewer. Only renders if a document has been loaded.
Parameters:
Name Type Argument Description zoomfloat Zoom value.
xint <optional>
Horizontal position to scroll to.
yint <optional>
Vertical position to scroll to.
-
zoomToMouse(zoom, offsetX, offsetY)
-
Adjusts the viewer's zoom factor and positions the point on the document under the mouse at the same position after zooming in.
Parameters:
Name Type Description zoomfloat Zoom value
offsetXint The x offset from the mouse position to the viewer's position (e.g. taking into account toolbars)
offsetYint The y offset from the mouse position to the viewer's position (e.g. taking into side panels)
Events
-
annotationsLoaded
-
Triggered when all the document annotations have been loaded
Parameters:
Name Type Description evtobject jQuery's event object
-
beforeDocumentLoaded
-
Triggered just before the document has been loaded into the viewer
Parameters:
Name Type Description evtobject jQuery's event object
-
changePage
-
Triggered when the page should be changed. Only fired when using a non-scrollable custom display mode.
Parameters:
Name Type Description evtobject jQuery's event object
pageNumint The 1-indexed page number
-
click
-
Triggered for the click event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
dblClick
-
Triggered for the dblClick event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
displayModeUpdated
-
Triggered when the display mode is updated
Parameters:
Name Type Description evtobject jQuery's event object
-
displayPageLocation
-
Triggered when a page location should be displayed
Parameters:
Name Type Description evtobject jQuery's event object
pageNumint The 1-indexed page number
verticalOffsetfloat The offset from the top of the page
horizontalOffsetfloat The offset from the left of the page
-
documentLoaded
-
Triggered when a new document has been loaded
Parameters:
Name Type Description evtobject jQuery's event object
-
documentUnloaded
-
Triggered when the current document has been closed and unloaded
Parameters:
Name Type Description evtobject jQuery's event object
-
fitModeUpdated
-
Triggered when the fit mode has changed
Parameters:
Name Type Description evtobject jQuery's event object
fitModeobject The fit mode that has been changed to e.g. docViewer.FitMode.FitWidth
-
keyDown
-
Triggered for the keyDown event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
keyUp
-
Triggered for the keyUp event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
layoutChanged
-
Triggered when the layout has changed because pages have permanently been added, removed, moved or changed in some other way.
Parameters:
Name Type Description evtobject jQuery's event object
changesobject An object with keys added, removed, moved and contentChanged, indicating which pages have changed
-
mouseEnter
-
Triggered for the mouseEnter event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
mouseLeave
-
Triggered for the mouseLeave event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
mouseLeftDown
-
Triggered for the mouseLeftButtonDown event in the DocumentViewer's viewing area Attach like docViewer.on('mouseLeftDown', callback)
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
mouseLeftUp
-
Triggered for the mouseLeftButtonUp event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
mouseMove
-
Triggered for the mouseMove event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
mouseRightDown
-
Triggered for the mouseRightButtonDown event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
mouseRightUp
-
Triggered for the mouseRightButtonUp event in the DocumentViewer's viewing area
Parameters:
Name Type Description evtobject jQuery's event object
nativeEvtobject Event object of the native JavaScript event
-
pageComplete
-
Triggered when a page has been completely rendered.
Parameters:
Name Type Argument Description evtobject jQuery's event object
pageIndexobject The 0-indexed page index
canvasobject <optional>
The canvas for the page
-
pageNumberUpdated
-
Triggered when the page number is updated
Parameters:
Name Type Description evtobject jQuery's event object
pageNumberint The new page number (1-indexed)
-
rotationUpdated
-
Triggered when the page rotation has changed
Parameters:
Name Type Argument Description evtobject jQuery's event object
rotationCoreControls.PageRotation The new viewing rotation.
pageNumbernumber <optional>
Optionally the specific page number that had its rotation changed
-
searchInProgress
-
Triggered when a search starts or ends
Parameters:
Name Type Description evtobject jQuery's event object
inProgressboolean Whether a search is in progress or not
isFullSearchboolean Whether this is a full text search or not
-
textSelected
-
Triggered when the selected text has changed
Parameters:
Name Type Description evtobject jQuery's event object
quadsarray An array of bounding box quads of the selected text
textstring The selected text
pageIndexint The zero-indexed page number that the text was selected on
-
toolModeUpdated
-
Triggered when the tool mode has changed
Parameters:
Name Type Description evtobject jQuery's event object
toolModeClassobject The tool mode class that has been changed to.
-
zoomUpdated
-
Triggered when the zoom level has been updated
Parameters:
Name Type Description evtobject jQuery's event object
zoomint The new zoom level of the viewer