Class PDFTron.WebViewer
PDFTron.WebViewer Represents a WebViewer which is a document viewer built using either HTML5, Silverlight or Flash technologies.
Constructor Attributes | Constructor Name and Description |
---|---|
PDFTron.WebViewer(options, element)
Creates a WebViewer instance and embeds it on the HTML page.
|
Method Attributes | Method Name and Description |
---|---|
Controls if the document's Zoom property will be adjusted so that the height of the current page or panelwill exactly fit into the available space.
|
|
fitPage()
Controls if the document's Zoom property will be adjusted so that the width and height of the current page or panelwill fit into the available space.
|
|
fitWidth()
Controls if the document's Zoom property will be adjusted so that the width of the current page or panelwill exactly fit into the available space.
|
|
Gets the current page number of the document loaded in the WebViewer.
|
|
Gets the layout mode of the document in the WebViewer.
|
|
Gets the total number of pages of the loaded document.
|
|
Gets the value whether the side window is visible or not.
|
|
Gets the current tool mode of the WebViewer.
|
|
Gets the zoom level of the document.
|
|
Goes to the first page of the document.
|
|
Goes to the last page of the document.
|
|
Goes to the next page of the document.
|
|
Goes to the previous page of the document.
|
|
Detects if the current browser is on a mobile device.
|
|
loadDocument(url)
Loads a document to the WebViewer.
|
|
Rotates the document in the WebViewer clockwise.
|
|
Rotates the document in the WebViewer counter-clockwise.
|
|
searchText(pattern, searchMode)
Searches the loaded document finding for the matching pattern.
|
|
setCurrentPageNumber(pageNumber)
Sets the current page number of the document loaded in the WebViewer.
|
|
setLayoutMode(layout)
Sets the layout mode of the document in the WebViewer.
|
|
setOnPageChangeCallback(callback)
Registers a callback when the document's page number is changed.
|
|
setOnPageZoomCallback(callback)
Registers a callback when the document's zoom level is changed.
|
|
setShowSideWindow(value)
Sets the value whether the side window is visible or not.
|
|
setToolMode(toolMode)
Sets the tool mode of the WebViewer.
|
|
setZoomLevel(zoomLevel)
Sets the zoom level of the document.
|
|
zoom()
Controls if the document's Zoom property will be freely adjusted and not constrained with the width and height of thecurrent page or panel.
|
Event Attributes | Event Name and Description |
---|---|
A jQuery event bound on the element, triggered when the display mode has changed.
|
|
A jQuery event bound on the element, triggered when a document has been loaded in the viewer.
|
|
A jQuery event bound on the element, triggered when the page number has changed.
|
|
ready()
A jQuery event bound on the element, triggered when the viewer is ready, before a document is loaded.
|
|
A jQuery event bound on the element, triggered when the tool mode has changed.
|
|
A jQuery event bound on the element, triggered when the zoom level has changed.
|
Class Detail
PDFTron.WebViewer(options, element)
Creates a WebViewer instance and embeds it on the HTML page.
e.g. var viewerElement = document.getElementById('viewer');myWebViewer = new PDFTron.WebViewer({ type: "html5,html5Mobile,silverlight,flash", initialDoc : "/host/GettingStarted.xod", enableAnnotations: true, streaming : false }, viewerElement);
- Parameters:
- options
- options passed to the specific WebViewer. Options must have the following:
- type: the type of WebViewer to load. Values must be comma-separated in order of preferred WebViewer.
- initialDoc: the URL path to a xod document to load on startup, it is recommended to use absolute paths.
- streaming: a boolean indicating whether to use http or streaming PartRetrieve, it is recommened to keep streaming false for better performance. (default false)
- enableAnnotations: a boolean to enable anontations on supported viewer types.(HTML5 only, default false)
- enableOfflineMode: a boolean to enable offline mode.(HTML5 only, default false)
- enableReadOnlyMode: a boolean to enable annotations read-only mode.(HTML5 only, default false)
- config: a URL path to a JavaScript configuration file that holds UI customizations. (HTML5 only)
- serverUrl: a URL to the server-side script that handles annotations. (HTML5 only, required for full annotation support)
- documentId: an identifier for the document to be used with annotations. (HTML5 only, required for full annotation support)
- cloudApiId: the share ID or session ID created from PDFNet Cloud API. Note: the browser must have CORS support. (optional, ignored when initialDoc is also set)
- showSilverlightControls: [Deprecated] a boolean to show/hide the controls on the Silverlight ReaderControl. (Silverlight only, default true)
- errorPage: a path to an HTML page to display errors. (optional)
- path: an alternate path to the WebViewer root folder. (optional)
- html5: an alternative path to the HTML5 WebViewer, relative to the "path" option. (optional)
- html5Mobile: an alternative path to the HTML5 Mobile WebViewer, relative to the "path" option. (optional)
- silverlight: an alternative path to the Silverlight WebViewer, relative to the "path" option. (optional)
- flash: an alternative path to the Flash WebViewer, relative to the "path" option. (optional)
- element
- the html element that will contain the web viewer (e.g. the element that will be parent of the WebViewer). This can be obtained through document.getElementById(), or through JQuery selector.
- Returns:
- {PDFTron.WebViewer} the instance of the WebViewer class
Method DetailfitHeight()Controls if the document's Zoom property will be adjusted so that the height of the current page or panelwill exactly fit into the available space. Not supported for mobile viewer.
fitPage()Controls if the document's Zoom property will be adjusted so that the width and height of the current page or panelwill fit into the available space.Not supported for mobile viewer.
fitWidth()Controls if the document's Zoom property will be adjusted so that the width of the current page or panelwill exactly fit into the available space. Not supported for mobile viewer.
getCurrentPageNumber()Gets the current page number of the document loaded in the WebViewer.- Returns:
- the current page number of the document
getLayoutMode()Gets the layout mode of the document in the WebViewer.Not supported for mobile viewer.- Returns:
- the layout mode of the document
getPageCount()Gets the total number of pages of the loaded document.- Returns:
- the total number of pages of the loaded document
getShowSideWindow()Gets the value whether the side window is visible or not.Not supported for mobile viewer.- Returns:
- true if the side window is shown
getToolMode()Gets the current tool mode of the WebViewer.Not supported for mobile viewer.- Returns:
- the current tool mode of the WebViewer
getZoomLevel()Gets the zoom level of the document.Not supported for mobile viewer.- Returns:
- the zoom level of the document
goToFirstPage()Goes to the first page of the document. Makes the document viewer display the first page of the document.
goToLastPage()Goes to the last page of the document. Makes the document viewer display the last page of the document.
goToNextPage()Goes to the next page of the document. Makes the document viewer display the next page of the document.
goToPrevPage()Goes to the previous page of the document. Makes the document viewer display the previous page of the document.
{boolean} isMobileDevice()Detects if the current browser is on a mobile device.- Returns:
- {boolean} true if this page is loaded on a mobile device.
loadDocument(url)Loads a document to the WebViewer.- Parameters:
- url
- url of the document to be loaded (relative urls may not work, it is recommended to use absolute urls)
rotateClockwise()Rotates the document in the WebViewer clockwise.Not supported for mobile viewer.
rotateCounterClockwise()Rotates the document in the WebViewer counter-clockwise.Not supported for mobile viewer.
searchText(pattern, searchMode)Searches the loaded document finding for the matching pattern.Search mode includes:- None
- CaseSensitive
- WholeWord
- SearchUp
- PageStop
- ProvideQuads
- AmbientString
- Parameters:
- 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"
setCurrentPageNumber(pageNumber)Sets the current page number of the document loaded in the WebViewer.- Parameters:
- pageNumber
- the page number of the document to set
setLayoutMode(layout)Sets the layout mode of the document in the WebViewer.Not supported for mobile viewer.- Parameters:
- layout
- the layout mode to set (see PDFTron.WebViewer.LayoutMode)
setOnPageChangeCallback(callback)Registers a callback when the document's page number is changed. (Silverlight only)[Depreciated]- Parameters:
- callback
- the JavaScript function to invoke when the document page number is changed
setOnPageZoomCallback(callback)Registers a callback when the document's zoom level is changed. (Silverlight only)[Depreciated]- Parameters:
- callback
- the JavaScript function to invoke when the document zoom level is changed
setShowSideWindow(value)Sets the value whether the side window is visible or not.Not supported for mobile viewer.- Parameters:
- value
- true to show the side window
setToolMode(toolMode)Sets the tool mode of the WebViewer.Not supported for mobile viewer.- Parameters:
- toolMode
- must be one of the PDFTron.WebViewer.ToolMode
setZoomLevel(zoomLevel)Sets the zoom level of the document.Not supported for mobile viewer.- Parameters:
- zoomLevel
- the new zoom level to set
zoom()Controls if the document's Zoom property will be freely adjusted and not constrained with the width and height of thecurrent page or panel.Not supported for mobile viewer.Event DetaildisplayModeChanged()A jQuery event bound on the element, triggered when the display mode has changed.e.g. $('#viewer').bind('displayModeChanged', function(event, data){//event triggered});
documentLoaded()A jQuery event bound on the element, triggered when a document has been loaded in the viewer.e.g. $('#viewer').bind('documentLoaded', function(event, data){//event triggered});
pageChanged()A jQuery event bound on the element, triggered when the page number has changed.e.g. $('#viewer').bind('pageChanged', function(event, data){//event triggered});
ready()A jQuery event bound on the element, triggered when the viewer is ready, before a document is loaded.e.g. $('#viewer').bind('ready', function(event, data){//event triggered});
toolModeChanged()A jQuery event bound on the element, triggered when the tool mode has changed.e.g. $('#viewer').bind('toolModeChanged', function(event, data){//event triggered});
zoomChanged()A jQuery event bound on the element, triggered when the zoom level has changed.e.g. $('#viewer').bind('zoomChanged', function(event, data){//event triggered});
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Feb 13 2013 12:56:55 GMT-0800 (PST)