This module was extracted from the PdfJs previewer plugin that was originally a Share Extras (http://share-extras.github.io/) project and later integrated into Alfresco Share 5.0. It was created exclusively to support the Aikau PdfJs module.
This module is responsible for rendering the overall view of a PDF document where each individual page is an instance of a DocumentPage. It is used to render both the main view and the thumbnail view in the PDF previewer plugin.
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Extends
- dijit/_WidgetBase
Mixes In
Members
-
activePage
-
Currently active page
- Default Value:
- null
- Source:
-
lastScale
-
Name of last scale to be auto-selected or selected by the user. This is the value which will be persisted when the document is unloaded and used to set up the same view the next time it is loaded.
- Default Value:
- null
- Source:
-
renderOnScrollZero :int
-
Counter for viewer scroll events - incremented on event, decremented some time later. Rendering will occur only when counter reaches zero.
Type:
- int
- Default Value:
- 0
- Source:
Methods
-
addPage()
-
Add a single page from a PDF document to this view
- Source:
-
addPages()
-
Add pages from a PDF document to this view
- Source:
-
addScrollListener()
-
Sets up a scroll event listener on the main viewer window. This allows rendering and publication of state to be performed as the user scrolls through the PDF.
- Source:
-
alignRows()
-
Centre the rows of pages horizontally within their parent viewer element by adding the correct amount of left padding
- Source:
-
getScrolledPageNumber() → {int}
-
Return the number of the page (1 or greater) that should be considered the 'current' page given the scroll position.
- Source:
Returns:
Number of the current page, 1 or greater- Type
- int
-
onResize()
-
- Source:
-
onScroll()
-
Event handler for scroll event within the view area this will publish on a topic that the PdfJs plugin should subscribe to so that it can update the active page and set the current page number.
- Source:
-
onScrollEvent(evt)
-
This function handles scroll events and calls the [onScroll] module:alfresco/preview/PdfJs/DocumentView#onScroll if a short timeout is reached before another scroll event occurs. This is done to prevent to many scroll publications being generated unnecessarily.
Parameters:
Name Type Description evt
event The scroll event object. - Source:
-
parseScale() → {float}
-
Calculate page zoom level based on the supplied value. Recognises numerical values and special string constants, e.g. 'page-fit'. Normally used in conjunction with setScale(), since this method does not set the current value.
- Source:
Returns:
Numerical scale value- Type
- float
-
postCreate()
-
- Source:
-
removeScrollListener()
-
Removes the scroll event listener created by the [addScrollListener] module:alfresco/preview/PdfJs/DocumentView#addScrollListener function.
- Source:
-
render()
-
Render page containers and set their sizes. This does not render the page content itself, neither canvas or text layers.
- Source:
-
renderVisiblePages()
-
Render pages in the visible area of the viewer (or near it) given the current scroll position
- Source:
-
reset()
-
Remove all existing canvas content
- Source:
-
scrollTo(n)
-
Scroll the viewer to the given page number
Parameters:
Name Type Description n
int Number of the page to scroll to, 1 or greater. - Source:
-
setActivePage()
-
Set the currently-active page number
- Source:
-
setScale(value)
-
Set the scale of the view and remove all previously-rendered document content
Parameters:
Name Type Description value
float numerical scale value - Source: