Below is the description of each Print2Flash 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. |
|
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. |
|
adjustToolbarColor (hue,saturation,brightness,contrast) |
hue - hue adjustment
value. Valid values are from -180 to 180
saturation - saturation adjustment value. Valid values are from -100
to 100
brightness - brightness adjustment value. Valid values are from -100
to 100
contrast - contrast adjustment value. Valid values are from -100 to
100 |
None |
Adjusts toolbar button and
control color. This allows changing toolbar colors to a certain degree. Some
useful parameter combinations can be found in the help topic on
ColorAdjustment property of Profile object.
For example, to change toolbar colors to green you should use this call:
adjustToolbarColor(-180,38,-4,0) |
|
Search |
| SearchText(text) |
text - text to search for |
true if text was found and false -
otherwise |
Searches for the next occurrence of text string
in the document text as if Search
button were pressed by the user. If this function is called for the first
time or with another text value as in previous call, the search
starts from the document beginning. On contrary, if this function is called
with the same text value as in previous call, the search is continued
from the previously found location. To make search start from the beginning
for the same text value, call ResetTextSearch function before search
|
| findNext() |
None |
true if text was found and false -
otherwise |
Searches for the text in the
Search text box. The search begins from the end of the current selection. To
make search start from the beginning of the document, call ResetTextSearch function before search |
| ResetTextSearch() |
None |
None |
Resets text search so that the next search
conducted by SearchText function always starts from the beginning of the
document. Calling of this function is recommended before each new search |
| getFindText() |
None |
Text in the Search box |
Returns the text in the Search
text box as a string |
| setFindText(text) |
text -text to set in the
Search text box |
None |
Sets the text in the Search
text box to a text value. |
|
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 instance of
the specified page |
Returns a reference to the
MovieClip 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. The function should be called only after
the needed page is already loaded (see
onPageLoaded event) and is
available from
Flash only. |
| OpenHelpPage() |
None |
None |
Opens the Print2Flash 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 |
|
setSize(width, height) |
width - width of the
document movie;
height - height of the document movie |
None |
Sets the Print2Flash document
movie size to the specified width and height.
This function is available from
Flash or Flex only. See Using Print2Flash Document API from other
Applications to learn how to set document movie size from other
applications. |
| 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. |