new ReaderControl(options)
Creates a new instance of ReaderControl
Parameters:
Name | Type | Description |
---|---|---|
options |
object | Options for the reader control |
- See:
-
- ReaderControl.html ReaderControl.js ReaderControl.css
Extends
Members
-
<static> config
-
Static configuration options for ReaderControl
Properties:
Name Type Description customScript
string a URL path to a custom JavaScript file that is loaded through ajax.
customStyle
string a URL path to a custom CSS file that is loaded through ajax.
defaultUser
string the Author name that is set for every annotation created by this client if "user" is not specified in the query parameter.
serverURL
string a URL path to a server handler for annotation loading and saving.
ui
object Static UI configuration options for ReaderControl.
Properties
Name Type Argument Default Description hideSidePanel
boolean <optional>
false hides the side panel
hideAnnotationPanel
boolean <optional>
false hides the side panel's annotation tab
hideControlBar
boolean <optional>
false hides the top control bar
hideDisplayModes
boolean <optional>
false hides the display mode dropdown button in the control bar
hideZoom
boolean <optional>
false hides the zoom selection controls in the control bar
hideTextSearch
boolean <optional>
false hides the text search controls in the control bar
hidePrint
boolean <optional>
false hides the print button
Example
Usage: define these static properties before creating a new instance of ReaderControl
Methods
-
enableCopyAndTextSelection(enable)
-
Enables/disables text search tool from UI
Parameters:
Name Type Description enable
-
enableCopyAndTextSelection(enable)
-
Enables/disables text selection from UI
Parameters:
Name Type Description enable
-
fitHeight()
-
Controls if the document's Zoom property will be adjusted so that the height of the current page or panel will exactly fit into the available space. Not supported by HTML5 viewers.
- Inherited From:
-
fitPage()
-
Controls if the document's Zoom property will be adjusted so that the width and height of the current page or panel will fit into the available space. Not supported for mobile viewer.
- Inherited From:
- Overrides:
-
fitWidth()
-
Controls if the document's Zoom property will be adjusted so that the width of the current page or panel will exactly fit into the available space. Not supported for mobile viewer.
- Inherited From:
- Overrides:
-
fitZoom()
-
Sets the FitMode to Zoom, where the zoom level is free from pre-defined fit modes.
- Inherited From:
- Overrides:
-
fullTextSearch(pattern)
-
Starts a search through the entire document for the specified pattern
Parameters:
Name Type Description pattern
string The pattern to search for in the document
-
getCurrentPageNumber()
-
Gets the current page number
- Inherited From:
Returns:
the current page number
- Type
- integer
-
getFitMode()
-
Gets the current fit mode
- Inherited From:
- Overrides:
Returns:
the current fit mode
- Type
- object
-
getLayoutMode()
-
Gets the layout mode of the document. Not supported for mobile viewer.
- Inherited From:
- Overrides:
Returns:
the layout mode of the document
-
getPageCount()
-
Gets the total page count of the loaded document
- Inherited From:
Returns:
the total page count of the loaded document
- Type
- integer
-
getShowSideWindow()
-
Gets the value whether the side window is visible or not. Not supported for mobile viewer.
- Inherited From:
- Overrides:
Returns:
true if the side window is shown
-
getToolMode()
-
Gets the current tool mode
- Inherited From:
Returns:
the current tool mode
- Type
- object
-
getZoomLevel()
-
Gets the current zoom level
- Inherited From:
- Overrides:
Returns:
the current zoom level in float, where 1.0 is 100%.
- Type
- number
-
goToFirstPage()
-
Navigates to the first page of the document
- Inherited From:
- Overrides:
-
goToLastPage()
-
Navigates to the last page of the document
- Inherited From:
- Overrides:
-
goToNextPage()
-
Navigates to the next page of the document. This method will increment the current page number by 1, regardless of display modes (where more than 1 page is displayed at a time).
- Inherited From:
- Overrides:
-
goToPrevPage()
-
Navigates to the previous page of the document. This method will decrement the current page number by 1, regardless of display modes (where more than 1 page is displayed at a time).
- Inherited From:
- Overrides:
-
loadDocument(doc, options)
-
Loads a XOD document into the ReaderControl
Parameters:
Name Type Description doc
string a URL path to a XOD file
options
object an object that contains options for loading a document. Possible properties are [streaming, decrypt, decryptOptions]
Properties
Name Type Description streaming
a boolean that turns on chunked transfer encoding as a fallback if true.
decrypt
a function for handling XOD decryption
decryptOptions
an object containing options for XOD decryption
- Inherited From:
-
notesPanelVisible()
-
Returns whether the notes panel is currently visible or not.
Returns:
Whether the notes panel is visible or not
- Type
- boolean
-
print()
-
Displays the WebViewer print dialog
-
rotateClockwise()
-
Rotates the document viewer's orientation by 90 degrees clockwise.
- Inherited From:
- Overrides:
-
rotateCounterClockwise()
-
Rotates the document viewer's orientation by 90 degrees counter clockwise.
- Inherited From:
- Overrides:
-
saveAnnotations()
-
Saves the annotations using the specified serverURL
- Inherited From:
- Overrides:
-
searchText(pattern, searchMode)
-
Searches the loaded document finding for the matching pattern.
Search mode includes:
- None
- CaseSensitive
- WholeWord
- SearchUp
- PageStop
- ProvideQuads
- AmbientString
Parameters:
Name Type Description pattern
the pattern to look for
searchMode
must one or a combination of the above search modes. To combine search modes, simply pass them as comma separated values in one string. i.e. "CaseSensitive,WholeWord"
- Inherited From:
- Overrides:
-
setContextMenu(readonly)
-
Sets up the right-click context menu in the viewer Calling this function will force it to update based on the readonly value
Parameters:
Name Type Description readonly
boolean Used to determine which tools to display. Annotation tools shouldn't be shown in readonly mode
-
setCurrentPageNumber(pageNumber)
-
Sets the current page number and navigates to the specified page in the viewer.
Parameters:
Name Type Description pageNumber
integer the new page number
- Inherited From:
- Overrides:
-
setFitMode(fitMode)
-
Sets the fit mode
Parameters:
Name Type Description fitMode
object the object representing the fit mode
- Inherited From:
- Overrides:
-
setLayoutMode(layout)
-
Sets the layout mode of the document. Not supported for mobile viewer.
Parameters:
Name Type Description layout
the layout mode to set
- Inherited From:
- Overrides:
-
setSearchInLeftPanel(text)
-
Search a text from the whole document
Parameters:
Name Type Description text
string Text to search
-
setSearchModes(searchModes)
-
Sets the search mode. All subsequent text searches will use the search mode that was set.
Parameters:
Name Type Description searchModes
-
setShowSideWindow(value)
-
Sets the value whether the side window is visible or not. Not supported for mobile viewer.
Parameters:
Name Type Description value
true to show the side window
- Inherited From:
- Overrides:
-
setToolbarVisibility(isVisible)
-
Shows or hides the top toolbar
Parameters:
Name Type Description isVisible
boolean Whether the toolbar should be shown or hidden
-
setToolMode(toolMode)
-
Sets the tool mode
Parameters:
Name Type Description toolMode
object the object representing the tool mode
- Inherited From:
-
setVisibleTab(index)
-
Sets the visible tab in the left panel
Parameters:
Name Type Description index
number The index of the tab to make active (0-indexed)
-
setZoomLevel(zoomLevel)
-
Sets the current zoom level
Parameters:
Name Type Description zoomLevel
number the new zoom level, where 1.0 is 100%.
- Inherited From:
- Overrides:
-
showNotesPanel(value)
-
Shows or hides the notes panel.
Parameters:
Name Type Description value
boolean Whether the notes panel should be shown or hidden
Events
-
documentLoaded
-
A global DOM event that is triggered when a document has been loaded.
Parameters:
Name Type Description e
a JavaScript event object
-
fitModeChanged
-
A global DOM event that is triggered when the fit mode has changed
Parameters:
Name Type Description e
a JavaScript event object
toolMode
object the new fit mode
-
layoutModeChanged
-
A global DOM event that is triggered when the display mode has changed
Parameters:
Name Type Description e
a JavaScript event object
toolMode
object the new display mode
-
pageChanged
-
A global DOM event that is triggered when the current page number has changed.
Parameters:
Name Type Description e
a JavaScript event object
pageNumber
integer the new 1-based page number
-
pageCompleted
-
A global DOM event that is triggered when a page had finished rendering.
Parameters:
Name Type Description e
a JavaScript event object
pageNumber
integer the 1-based page number that finished rendering
-
viewerLoaded
-
A global DOM event that is triggered when the viewer has been loaded and ReaderControl is constructed.
Parameters:
Name Type Description e
a JavaScript event object
-
zoomChanged
-
A global DOM event that is triggered when the document view's zoom level has changed.
Parameters:
Name Type Description e
a JavaScript event object
zoom
number the new zoom level value