Class: ReaderControl

ReaderControl

Represents the full-featured ReaderControl reusable UI component that extends DocumentViewer.


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 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:

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:
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:

goToLastPage()

Navigates to the last page of the document

Inherited From:

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:

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:

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:

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:

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:

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:

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 sub-sequent 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:

setToolMode(toolMode)

Sets the tool mode

Parameters:
Name Type Description
toolMode object

the object representing the tool mode

Inherited From:

setZoomLevel(zoomLevel)

Sets the current zoom level

Parameters:
Name Type Description
zoomLevel number

the new zoom level, where 1.0 is 100%.

Inherited From:

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