Class CoreControls.Document
Represents a document.
Constructor Attributes | Constructor Name and Description |
---|---|
Constructs a new empty Document, representing a document with individual pages (canvases) that can be displayed on screen and printed.
|
Method Attributes | Method Name and Description |
---|---|
Cancels a download for offline mode in progress.
|
|
Returns an array containing the bookmarks in the document.
|
|
GetLinks(pageIndex)
Returns an array containing the links on the specified page of the document.
|
|
Returns whether offline mode is currently enabled or not.
|
|
Returns the number of pages in a document.
|
|
GetPageInfo(pageIndex)
Returns an object containing the width and height of a page.
|
|
Used to know if a document contains thumbnails.
|
|
InitOfflineDB(onComplete)
Initializes the offline database for use.
|
|
Whether the document has already been downloaded for offline mode or not.
|
|
LoadAsync(partRetriever, callback)
Initialize a Document so that it can be used to load page canvases.
|
|
LoadCanvasAsync(pageIndex, zoom, pageRotation, drawComplete(canvas,pageIndex), drawProgressive, canvasNum)
Loads a canvas for a particular page index.
|
|
LoadThumbnailAsync(pageNumber, onLoadThumbnail(HTMLImageElement|HTMLCanvasElement))
Loads a thumbnail image for a particular page.
|
|
SetOfflineModeEnabled(enabled)
Sets whether offline mode is enabled or not.
|
|
StoreOffline(onComplete, onProgress)
Downloads the document for offline viewing.
|
Class Detail
CoreControls.Document()
Constructs a new empty Document, representing a document with individual pages (canvases) that can be displayed on screen and printed.
Method Detail
CancelOfflineModeDownload()
Cancels a download for offline mode in progress. If there is no current download then this does nothing.
{array}
GetBookmarks()
Returns an array containing the bookmarks in the document.
- Returns:
- {array} An array containing the bookmarks in the current document.
{array}
GetLinks(pageIndex)
Returns an array containing the links on the specified page of the document.
- Parameters:
- {number} pageIndex
- The page number, zero-indexed, that the links are on.
- Returns:
- {array} An array containing the links on the specified page of the document.
GetOfflineModeEnabled()
Returns whether offline mode is currently enabled or not.
{number}
GetPageCount()
Returns the number of pages in a document.
- Returns:
- {number} The number of the pages in the current document.
{object}
GetPageInfo(pageIndex)
Returns an object containing the width and height of a page.
- Parameters:
- {number} pageIndex
- The page number, zero-indexed, of the requested canvas.
- Returns:
- {object} An object representing the page info. Contains the properties "width" and "height".
{boolean}
IncludesThumbnails()
Used to know if a document contains thumbnails.
- Returns:
- {boolean} True if the document contains thumbnails.
InitOfflineDB(onComplete)
Initializes the offline database for use. Must be called before any other offline mode functions are used.
- Parameters:
- {function} onComplete
- The function that's called when the offline database is ready for use.
IsDownloaded()
Whether the document has already been downloaded for offline mode or not.
LoadAsync(partRetriever, callback)
Initialize a Document so that it can be used to load page canvases.
- Parameters:
- {CoreControls.PartRetrievers.PartRetriever} partRetriever
- An instance of PartRetriever.
- {function(?Error)} callback
- The callback to call when the Document has been initialized.
LoadCanvasAsync(pageIndex, zoom, pageRotation, drawComplete(canvas,pageIndex), drawProgressive, canvasNum)
Loads a canvas for a particular page index.
- Parameters:
- {number} pageIndex
- The page number, zero-indexed, of the requested canvas.
- {number} zoom
- The zoom value to render the page at.
- {pageRotation} pageRotation
- The rotation of the page. Valid values are CoreControls.PageRotation.e_0, CoreControls.PageRotation.e_90, CoreControls.PageRotation.e_180, CoreControls.PageRotation.e_270.
- {function} drawComplete(canvas,pageIndex)
- The callback to call when the canvas has been completely rendered.
- {function} drawProgressive
- The callback to call when the canvas has been partially rendered.
- {number} canvasNum
- Force the page to be split into this many canvases
LoadThumbnailAsync(pageNumber, onLoadThumbnail(HTMLImageElement|HTMLCanvasElement))
Loads a thumbnail image for a particular page.
- Parameters:
- {string} pageNumber
- The page number of the requested thumbnail.
- {function} onLoadThumbnail(HTMLImageElement|HTMLCanvasElement)
- The callback to call when the thumbnail has been retrieved. It is passed an image element if the .xod file contains thumbnails and a canvas element otherwise.
SetOfflineModeEnabled(enabled)
Sets whether offline mode is enabled or not.
- Parameters:
- {boolean} enabled
- The new value for whether offline mode is enabled or not.
StoreOffline(onComplete, onProgress)
Downloads the document for offline viewing.
- Parameters:
- {function} onComplete
- The function that's called when the document has finished being downloaded or the download has been cancelled
- {function(number)} onProgress
- The function that's called on each update in progress of the download.The fraction downloaded is passed as a parameter. (eg 50% downloaded passes 0.5)