Class Index

Classes


Class PDFTron.WebViewer

PDFTron.WebViewer Represents a WebViewer which is a document viewer built using HTML5.

Class Summary
Constructor Attributes Constructor Name and Description
 
PDFTron.WebViewer(options, element)
Creates a WebViewer instance and embeds it on the HTML page.
Method Summary
Method Attributes Method Name and Description
 
Opens the XOD document through the browser to be downloaded.
 
Cleans up the resources that were used for printing.
[deprecated]  
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.
[deprecated]  
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.
[deprecated]  
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.
 
Gets the current page number of the document loaded in the WebViewer.
 
Gets the current fit mode of the viewer
 
Gets the instance of the ReaderControl object loaded by WebViewer.
 
Gets the layout mode of the document in the WebViewer.
 
Gets the total number of pages of the loaded document.
[deprecated]  
Gets the value whether the side window is visible or not.
 
Gets the visibility of the default side window.
 
Gets the visibilty of the default toolbar control.
 
Gets the current tool mode of the WebViewer.
 
Gets the currently loaded viewer type.
 
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.
 
Detects if the give url string is in the same origin as the current page
 
loadDocument(url, loadOptions)
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.
 
setAdminUser(isAdminUser)
Sets the administrative permissions for the current annotation user.
 
Sets the annotation author.
 
Sets the current page number of the document loaded in the WebViewer.
 
setFitMode(fitMode)
Sets the fit mode of the viewer.
 
setLayoutMode(layoutMode)
Sets the layout mode of the document in the WebViewer.
 
setReadOnly(isReadOnly)
Sets the viewer's annotation read-only state.
[deprecated]  
Sets the value whether the side window is visible or not.
 
Gets the visibility of the default side window.
 
Sets the visibilty of the default toolbar control.
 
setToolMode(toolMode)
Sets the tool mode of the WebViewer.
 
setZoomLevel(zoomLevel)
Sets the zoom level of the document.
 
Starts a printing job for the passed in pages.
[deprecated]  
zoom()
Controls if the document's Zoom property will be freely adjusted and not constrained with the width and height of the current page or panel.
Event Summary
Event Attributes Event Name and Description
[deprecated]  
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 layout mode has changed.
 
A jQuery event bound on the element, triggered when the page number has changed.
 
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",
	initialDoc : "/host/GettingStarted.xod",
	enableAnnotations: true,
	streaming : false
	}, viewerElement);
Parameters:
{PDFTron.WebViewer.Options} options
options passed to the specific WebViewer.
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 Detail
downloadXodDocument()
Opens the XOD document through the browser to be downloaded.
Since:
version 1.7

endPrintJob()
Cleans up the resources that were used for printing. (Desktop only)

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 for mobile viewer.
Deprecated:
since 1.7. Use PDFTron.WebViewer#setFitMode instead.

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.
Deprecated:
since 1.7. Use PDFTron.WebViewer#setFitMode instead.

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.
Deprecated:
since 1.7. Use PDFTron.WebViewer#setFitMode instead.

getCurrentPageNumber()
Gets the current page number of the document loaded in the WebViewer.
Returns:
the current page number of the document

{PDFTron.WebViewer.FitMode} getFitMode()
Gets the current fit mode of the viewer
Since:
version 1.7
Returns:
{PDFTron.WebViewer.FitMode}

getInstance()
Gets the instance of the ReaderControl object loaded by WebViewer.
Returns:
a ReaderControl instance

{PDFTron.WebViewer.LayoutMode} getLayoutMode()
Gets the layout mode of the document in the WebViewer. Not supported for mobile viewer.
Returns:
{PDFTron.WebViewer.LayoutMode} 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.
Deprecated:
since version 1.7. Replaced by PDFTron.WebViewer#getSideWindowVisibility.
Returns:
true if the side window is shown

{boolean} getSideWindowVisibility()
Gets the visibility of the default side window. Not supported for mobile viewer.
Returns:
{boolean} true if the side window is visible.

{boolean} getToolbarVisibility()
Gets the visibilty of the default toolbar control.
Returns:
{boolean} true if the toolbar is visible.

{PDFTron.WebViewer.ToolMode} getToolMode()
Gets the current tool mode of the WebViewer. Not supported for mobile viewer.
Returns:
{PDFTron.WebViewer.ToolMode} the current tool mode of the WebViewer

{string} getViewerType()
Gets the currently loaded viewer type. This is only valid after the documentLoaded event.
Returns:
{string} the viewer type: "html5" or "html5Mobile"

{number} getZoomLevel()
Gets the zoom level of the document.
Returns:
{number} 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.

{boolean} isSameOrigin(url)
Detects if the give url string is in the same origin as the current page
Parameters:
{type} url
the URL to test against
Returns:
{boolean} true if the provided URL is in the same origin as the current page

loadDocument(url, loadOptions)
Loads a document to the WebViewer.
Parameters:
{String} url
the URL of the document to be loaded
loadOptions
options for loading a new document
loadOptions.documentId
a unique identifer for the document. When an annotation server is specified, this ID will be sent to the server
loadOptions.filename
the filename of the document.
loadOptions.customHeaders
an object custom HTTP headers to use when retrieving the document from the specified url. For example: {'Authorization':'Basic dXNlcm5hbWU6cGFzc3dvcmQ='}

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

setAdminUser(isAdminUser)
Sets the administrative permissions for the current annotation user.
Parameters:
{boolean} isAdminUser

setAnnotationUser(username)
Sets the annotation author.
Parameters:
{string} username

setCurrentPageNumber(pageNumber)
Sets the current page number of the document loaded in the WebViewer.
Parameters:
pageNumber
the page number of the document to set

setFitMode(fitMode)
Sets the fit mode of the viewer. This is equivalent to calling the methods: fitWidth, fitHeight, fitPage, zoom
Parameters:
{PDFTron.WebViewer.FitMode} fitMode
Since:
version 1.7

setLayoutMode(layoutMode)
Sets the layout mode of the document in the WebViewer. Not supported for mobile viewer.
Parameters:
{PDFTron.WebViewer.LayoutMode} layoutMode
the layout mode to set.

setReadOnly(isReadOnly)
Sets the viewer's annotation read-only state. When read-only, users will be allowed to view annotations and its popup text contents, but will not be able to edit or create new annotations.
Parameters:
{boolean} isReadOnly

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
Deprecated:
since 1.7. Replaced by PDFTron.WebViewer#setShowSideWindow.

setSideWindowVisibility(value)
Gets the visibility of the default side window. Not supported for mobile viewer.
Parameters:
{boolean} value
true to show the side window

setToolbarVisibility(isVisible)
Sets the visibilty of the default toolbar control.
Parameters:
{boolean} isVisible
true if the toolbar is visible.

setToolMode(toolMode)
Sets the tool mode of the WebViewer. Not supported for mobile viewer.
Parameters:
{PDFTron.WebViewer.ToolMode} toolMode
must be one of the PDFTron.WebViewer.ToolMode

setZoomLevel(zoomLevel)
Sets the zoom level of the document.
Parameters:
zoomLevel
the new zoom level to set

startPrintJob(pages)
Starts a printing job for the passed in pages. (Desktop only)
Parameters:
{string} pages
The pages that should be printed. Multiple pages can be separated by commas and ranges can be specified by a dash (e.g. 1,3-5)

zoom()
Controls if the document's Zoom property will be freely adjusted and not constrained with the width and height of the current page or panel. Not supported for mobile viewer.
Deprecated:
since 1.7. Use PDFTron.WebViewer#setFitMode instead.
Event Detail
displayModeChanged()
A jQuery event bound on the element, triggered when the display mode has changed.
e.g. $('#viewer').bind('displayModeChanged', function(event, data){//event triggered});
Deprecated:
since version 1.7. Use layoutModeChanged instead

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});

layoutModeChanged()
A jQuery event bound on the element, triggered when the layout mode has changed.
e.g. $('#viewer').bind('layoutModeChanged', function(event, data){//event triggered});
Since:
version 1.7

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 08 2017 11:14:42 GMT-0800 (PST)