Quantcast

Class Reference

vuzit.Viewer

Vuzit document viewer control class.

Summary
vuzit.ViewerVuzit document viewer control class.
Functions
fromIdCreates a new Viewer object for a document with the requested web ID and returns it.
fromUrlCreates a new Viewer object for a document with the requested url and returns it.
constructor
destroyCleans up all objects and memory.
destroyDisplayCleans up all objects and memory related only to displaying a Viewer on a screen
displayCreates the viewer display for the document defined in the “url” property.
getDocumentThe Document instance member.
getPageNumberThe current page number.
getUrlThe current URL of the document.
getZoomThe current zoom level.
hideHides the viewer on the page.
isDestroyedReturns whether the window is in destroyed state.
pageNextJumps to the next page.
pagePreviousJumps to the previous page.
setFullScreenUrlSets the URL of the full screen link.
setPageNumberSets the current page.
setSizeSets the size of the control after initialization has occurred.
setIdSets the id of the document.
setUrlSets the URL of the document.
setZoomSets the current zoom level.
showUnhides the viewer on the screen.

Functions

fromId

fromId: function(id,
inputOptions)

Creates a new Viewer object for a document with the requested web ID and returns it.

Parameters

idThe document’s Vuzit web id
inputOptionsSets the options below

Options

onCompletefunction to run when the document has finished loading
sslboolean whether or not to use SSL for your transactions (Premium customers only)

Returns

vuzit.Viewer

Example

var viewer = vuzit.Viewer.fromId("1a", {onComplete: doSomething, ssl: false} );

fromUrl

fromUrl: function(url,
inputOptions)

Creates a new Viewer object for a document with the requested url and returns it.

Parameters

urlThe document’s url address
inputOptionsSets the options below

Options

onCompletefunction to run when the document has finished loading
sslboolean whether or not to use SSL for your transactions (Premium customers only)

Returns

vuzit.Viewer

Example

var viewer = vuzit.Viewer.fromUrl("http://someurl.com", {onComplete: doSomething, ssl: false} );

constructor

Parameters

identifierThe url address of the document
optionsSets the options below

Options

onCompletefunction to run when the document has finished loading
sslboolean whether or not to use SSL for your transactions (Premium customers only)
signatureauthentication signature described here: http://vuzit.com/developer/documents_api
timestampauthentication timestamp described here: http://vuzit.com/developer/documents_api

Returns

vuzit.Viewer

Example

var viewer = new vuzit.Viewer("http://someurl.com", {onComplete: doSomething, ssl: false} );

destroy

destroy: function()

Cleans up all objects and memory.

Parameters

none

Returns

none

Example

viewer.destroy();

destroyDisplay

destroyDisplay: function()

Cleans up all objects and memory related only to displaying a Viewer on a screen

Parameters

none

Returns

none

Example

viewer.destroyDisplay();

display

display: function(div,
options)

Creates the viewer display for the document defined in the “url” property.

Parameters

divViewer html element <div>
optionsSets the options below

Options

pageSets the default page.  (Default: 1)
xSets the position in the X direction.  (Default: 0)
ySets the position in the Y direction.  (Default: 0)
showDownloadSets whether to show the download button
showPrintPdfSets whether to show the Print PDF button.  Button will only be shown for non-PDF and non-image documents.
showFullScreenSets whether to show the full screen link
showZoomsSets whether to show zoom buttons
showPagesSets whether to show the page number textbox and next page/previous page arrows
zoomSets the zoom level for the page.  (Default: 1)

Returns

none

Example

viewer.display(document.getElementById('vuzit_view'), {zoom: 1 });

getDocument

getDocument: function()

The Document instance member.

Parameters

none

Returns

vuzit.Document

Example

var document = viewer.getDocument();

getPageNumber

getPageNumber: function()

The current page number.

Parameters

none

Returns

integer

Example

var page_num = viewer.getPageNumber();

getUrl

getUrl: function()

The current URL of the document.

Parameters

none

Returns

string

Example

var url = viewer.getUrl();

getZoom

getZoom: function()

The current zoom level.

Parameters

none

Returns

integer

Example

var zoom_level = viewer.getZoom();

hide

hide: function()

Hides the viewer on the page.

Parameters

none

Returns

none

Example

viewer.hide();

isDestroyed

isDestroyed: function()

Returns whether the window is in destroyed state.

Parameters

none

Returns

boolean

Example

if (! viewer.isDestroyed) {
  viewer.setPageNumber(2);
}

pageNext

pageNext: function()

Jumps to the next page.

Parameters

none

Returns

none

Example

viewer.pageNext();

pagePrevious

pagePrevious: function()

Jumps to the previous page.

Parameters

none

Returns

none

Example

viewer.pagePrevious();

setFullScreenUrl

setFullScreenUrl: function(url)

Sets the URL of the full screen link.  The URL must have a “$[URL]” sub-sting in it to set the proper link.

Parameters

urlThe new url link

Returns

none

Example

viewer.setFullScreenUrl('http://example.com/viewer.htm?url=$[URL]');

setPageNumber

setPageNumber: function(page)

Sets the current page.

Parameters

pageThe new page number

Returns

none

Example

viewer.setPageNumber(2);

setSize

setSize: function(width,
height)

Sets the size of the control after initialization has occurred.  Useful for handling onresize events.

Parameters

widthThe width in pixels
heightThe height in pixels

Returns

none

Example

viewer.setSize(640, 480)

setId

setId: function(id)

Sets the id of the document.  Called by the constructor, but can also be called afterwards to bring in a new document to the Viewer.

Parameters

idSets the ID of the document

Returns

nothing

Example

viewer.setId('5');

setUrl

setUrl: function(url)

Sets the URL of the document.  Called by the constructor, but can also be called afterwards to bring in a new document to the Viewer.

Parameters

urlSets the URL of the document

Returns

nothing

Example

viewer.setUrl('http://example.com/some.pdf');

setZoom

setZoom: function(zoom)

Sets the current zoom level.

Parameters

zoomThe new zoom level

Returns

string

Example

viewer.setZoom(0);

show

show: function()

Unhides the viewer on the screen.

Parameters

none

Returns

none

Example

viewer.show();
fromId: function(id,
inputOptions)
Creates a new Viewer object for a document with the requested web ID and returns it.
fromUrl: function(url,
inputOptions)
Creates a new Viewer object for a document with the requested url and returns it.
destroy: function()
Cleans up all objects and memory.
destroyDisplay: function()
Cleans up all objects and memory related only to displaying a Viewer on a screen
display: function(div,
options)
Creates the viewer display for the document defined in the “url” property.
getDocument: function()
The Document instance member.
getPageNumber: function()
The current page number.
getUrl: function()
The current URL of the document.
getZoom: function()
The current zoom level.
hide: function()
Hides the viewer on the page.
isDestroyed: function()
Returns whether the window is in destroyed state.
pageNext: function()
Jumps to the next page.
pagePrevious: function()
Jumps to the previous page.
setFullScreenUrl: function(url)
Sets the URL of the full screen link.
setPageNumber: function(page)
Sets the current page.
setSize: function(width,
height)
Sets the size of the control after initialization has occurred.
setId: function(id)
Sets the id of the document.
setUrl: function(url)
Sets the URL of the document.
setZoom: function(zoom)
Sets the current zoom level.
show: function()
Unhides the viewer on the screen.

Documentation generated by Natural Docs.