Help Contents

Print2HTML5 Document API Functions

Below is the description of each Print2HTML5 Document Application Programming Interface function.
 
Signature Parameters Return value Comments
Navigation in the document
getCurrentPage() None The number of the currently displayed page Retrieves the number of the currently displayed page as shown in Go To Page text box
setCurrentPage(page) page - the number of the page to go to. Should be between 1 and the value returned by getNumberOfPages function None Moves document view to the specified page and makes it the current page as if the user entered a page number in Go To Page text box
NextPage() None None Displays the next document page as if Next Page button were pressed by the user
PreviousPage() None None Displays the previous document page as if Previous Page button were pressed by the user
getVisibleArea() None VisibleArea object describing the current visible area of the document Returns an object describing the current visible area of the document. You can use the return value to do one of the following:
  • Pass to setVisibleArea. This can be useful if the same document is being viewed on multiple computers, and you want to keep the visible areas in sync.
  • Compare with a previous value returned by getVisibleArea using equals method to determine if the visible area has been changed.
setVisibleArea (area:VisibleArea) area - VisibleArea object returned from a getVisibleArea function call None Adjusts the currently visible page/zoom/scroll/rotation to match the visible area described by the area object.
getScrollPosition() None Point object representing current scroll position Returns the current document scroll position
setScrollPosition (pos:Point) pos - new position Point object None Sets the current document scroll position to the value represented by pos parameter. Coordinates in pos object must be between 0 and the values returned by getMaxScrollPosition function
getMaxScrollPosition() None Point object representing maximum scroll position Returns the maximum document scroll position. Note that this value may be modified if document zoom level or rotation angle is changed
enableScrolling(enable) enable - flag specifying whether to enable scrolling. If true, scrolling is enabled; if false, scrolling is disabled None Enables or disables scrolling the document by user. If scrolling is disabled, scrollbars are not active, dragging mode  does not work, and scrolling with keyboard and mouse wheel is disabled.
goToLinkTarget(url, window) url - URL of the document or bookmark to open
window - window or HTML frame into which the document should load
• true if navigation was successful
• false otherwise
This function either opens a new web document in the specified window or navigates to the document bookmark.
If url parameter is a string of the form anchor:bmname, the documents scrolls to the bookmark with a name of bmname. The window argument is ignored in this case. If bmname is not a valid bookmark name in the document, no action is taken and false is returned. See Hyperlinks for more information.

Zooming in and out

getCurrentZoom() None The current document zoom level in percent Retrieves the current document zoom level as shown in Zoom text box
setCurrentZoom(zoom) zoom:
• "width" - fit width
• "page" - fit page
• Number - scale to specified percentage
None Sets the current document zoom level to either a specified percentage if you passed a number as zoom argument or scales the document so as to fit width or page

Toolbar control

getCurrentTool() None • "move" if drag tool is active
• "select" if text selection tool is active
Returns the currently active tool.
setCurrentTool(tool) tool:
• "move" (drag tool)
• "select" (text selection tool)
None Makes the given tool the active tool as if the user pressed Drag or Select Text button
setControlVisibility(mask) mask -a bitwise combination of flags corresponding to controls to display None Hides or displays part of the user interface in the  document. The mask should be a bitwise combination of flags detailed in INTERFACE_OPTION Enumeration topic.
setLanguage(language) language - language code None Changes toolbar hint language. Possible parameter values are discussed in the help topic on Language property of Profile object.

Text selection

getTextSelectionRange() None SelectionRange object Returns an object describing the current text selection. If no text is selected, this function returns null.
setTextSelectionRange (sel:SelectionRange) sel - the object describing the text selection None Selects the given range of text. You may pass null to deselect all the text.
getSelectedText() None Selected text Returns the selected text as a string. If no text is selected, an empty string is returned.

Other functions

getNumberOfPages() None The total number of pages in the document Retrieves the total number of pages in the document as shown in Total Pages indicator
getLoadedPages() None The total number of pages loaded so far in the document Retrieves the total number of pages loaded and shown so far in the document. The returned value can be between 0 and the value returned by getNumberOfPages function.
getPage(page) page - the number of page The MovieClip class or SVGDocument class nstance of the specified page Returns a reference to the SVG document class instance representing the specified page image.
You may use this reference to perform additional operations on the page movie clip: drawing, listening on events, etc. 
OpenHelpPage() None None Opens the Print2HTML5 document interface help page as if Help button were pressed by the user
OpenInNewWindow() None None Opens the document once again in a separate browser window as if Open In New Window button were pressed by the user
printTheDocument() None None Prints the document as if Print button were pressed by the user
Rotate() None None Rotates all document pages by 90 degrees clockwise as if Rotate button were pressed by the user
setFullScreen(fullScreen) fullScreen:Boolean - specifies if full screen mode should be activated (true) or deactivated (false) None Switches the document into full screen mode or back into normal mode.
setVisiblePages(from,to) from - the number of the first page to show,
to - the number of the last page to show
None Makes visible only the document pages numbered between from and to parameters. Other pages are hidden and cannot be scrolled by user. Note that if you make visible only certain pages, the document behaves as if there were fewer pages in it. For example, getNumberOfPages function would return less than actual number of pages.