ViewONE Pro .....................................................................................................................................................................10
Apple Macintosh users (JavaScript)....................................................................................................................................10
Apple Macintosh users (HTML).........................................................................................................................................11
Setting up Windows 2003 server..............................................................................................................12
Security note: Change since ViewONE 3.0.99 Standard and 1.0.99 Pro............................................................................16
General Applet Control...................................................................................................................................... 17
Opening documents and images........................................................................................................................ 19
Specifying an Annotations File.......................................................................................................................... 26
Saving documents and images........................................................................................................................... 27
setRotationArray(int angle, int page)..................................................................................................................................39
setMagBounds(int x, int y, int width, int height).................................................................................................................51
Selection and clipboard...................................................................................................................................... 55
Toolbars and Buttons......................................................................................................................................... 61
Menus and keys................................................................................................................................................... 68
The Event Handler and Event Handling.......................................................................................................... 82
Events handler change in ViewONE Version 3..................................................................................................................83
Events ids and descriptions.................................................................................................................................................84
Testing your Event Handler ................................................................................................................................................88
The MayScript tag...............................................................................................................................................................88
Introduction
ViewONE is a Java applet that extends your web b row ser so that y ou can vi ew, zoom,
magnify, scroll, pan, rotate and print your images and image do cuments quickly and
easily.
This document is the ViewONE JavaScript Manual and covers how to use and w hat
options are available for the ViewONE JavaScript API.
This document is designed to be used in conjunction w ith the ViewONE H TML and
Installation Manual.
(Please note: This manual does not cover the Jav ascript API for Anno tations, please see
the Applet Annotations Configuration Manual)
For further information about ViewONE please consult the following documents…
• ViewONE User Manual
• ViewONE HTML and Installation Manual
• ViewONE Annotations User Manual
• ViewONE Annotations Installation HTML and JavaScript Manual
• Various White Papers for in-depth analysis of specific a reas
• Latest ViewONE release notes found at
http://www.daeja.com/pub/start/release.html
7777
The Applet user interface
File
Open,
Close and
Save
Toolbar
Toggle
Print Page, Document
and Page Range
Zoom Area, Zoom In, Zoom Out,
Magnify, Zoom 100%, Fit to Width,
Fit to Height, Best Fit, Rotate
Clockwise, Rotate
Counterclockwise, Rotate 180, Flip
Horizontally, Flip Vertically, Invert
and Help
New Window
Scroll to
First,
Previous,
Next and
Last Page
Vertical
scrollbar
Image Area
Drag mouse
to pan
image
Document
Information
View Fullpage,
Thumbnails,
Two pages
Thumbs-left,
Thumbs bottom,
Thumbs right and
Thumbs top
Enhance mode
Help and progress
captions appear here
Horizontal scrollbar
Adjust Brightne ss
8888
Installing ViewONE
HTML:
To install ViewONE on your web site you must first download the ‘Update’ zip file from the
Daeja web site. This can be found by visiting www .daeja.com/pub/start/downloads.html
After unzipping the downloaded file you should have a directory named “v1files”. Thi s
directory contains the essential files required to install and use ViewONE.
Copy all files found in the “v1files” directory to your web server, pre ferably in a separa te
directory similarly named.
ViewONE Standard
If you have downloaded ViewONE Standard (with or without the Print Accelerator or
Annotations optional modules), then to use ViewONE on your w eb site, se tup a w eb pa ge
containing the following HTML…
If you have downloaded ViewONE Pro (with or without the Print Accelerator, Annota tions,
DjVu, PDF or other optional modules), then to use View ONE Pro on your w eb site, setup a
web page containing the following HTML…
In each case, you must change the “codebase ” value to poin t to the loca tion of the ‘v1 files’
directory that contains ViewONEs resource files (i.e. ji.jar, ji.cab and other .v1 files).
The codebase parameter specifies the location of the ji .jar, ji.cab and o ther file s relative
to
the location o f the H TM L p age . So in th is cas e it speci fies the “c ur ren t d ir ect ory ” w hi ch i s
“.”
(Note: PARAM NAME=cabbase” is required for M icrosoft Explorer users) .
Our downloadable demos include examples to assist y ou.
Mayscript parameter
When using JavaScript it is important to include the M AYSCRIPT parameter (see both
HTML samples above). This parameter is an enabl er for the JavaScript interface. Without
it, calls to JavaScript will not work.
Apple Macintosh user s (Jav aScr ipt)
Depending on the version of the operating sy stem us ed by Apple M acintosh co mputers,
JavaScript may or may not operate correctly .
Apple MacOS 8 and 9 computers utiliz e Apples Java en gine known as M RJ (M acintosh
Runtime Java). This particular Java engine did not have full support for JavaS cript to Java
Applets and so the JavaScript API will not operate with M RJ.
Apple MacOS X (10.x) computers utilize Apples upd ated Java 2 engine w hich does
include support for JavaScript to Java API’s.
10
1010
10
Apple Macintosh users (HTML)
ViewONE comes with a digital certificate which is required to permit the applet to print and
provide local caching. ViewONE is also Java 1.1.5 compliant.
Apple Macintosh 9 users will need to use IE4.5 (or l ater) and Apple M acintosh X (10.x ) can
use IE5, Netscape 7 or Mozi lla.
IE uses Apples run-time Java (called MRJ). Since the release o f IE4.5 Apple h ave
released several versions of MRJ. It is recommended that use rs use M RJ version 2.2 or
later. Netscape 7 and Mozilla browsers use Java 1.4 .x which is suppo rted by V iew ONE.
Using ViewONE Standard on IE for A pple Macintosh
To use IE (MRJ Java) you will hav e to ensure y our HTML speci fies the alternativ e archive
file…
ARCHIVE = “jis.jar”
Using ViewONE Pro on IE for A pple Macintosh
To use IE (MRJ Java) you will hav e to ensure y our HTML speci fies the alternativ e archive
file…
ARCHIVE = “ViewONEdsa.jar”
We have produced a demo w hich uses so me JavaScript to de tect Apple M ac users and
make appropriate changes automatically.
Demos are available at http://www.daeja.com/pub/start/downloads.html
11
1111
11
Setting up Windows 2003 server
If your server is running Windows 2003 with IIS 6, you w ill hav e to add two file extensions
to your w eb site “M IME Types” .
Unlike previous Windows servers, Windows 2003 p ermits only a limi ted number of file
extensions by default, all others must be enabled ma nually using the IIS consol e.
The additional mime types required to operate ViewONE are “.v1” and “.ant”. Note: if they
are not added to IIS 6 then ViewONE will display messa ges during start-up that files w ith
these extensions could not be found).
Both file extensions should be set to the mime type “application/octet-stream”, as follows..
Open up IIS 6 console, then right-click on the top w eb space en try to highlight
“Properties”…
12
1212
12
Click on the properties menu to display the properties dialog…
Click on the MIME Type button to display the M IM E Type dialog…
Use the New button to add two new M IM E types…
13
13
1313
Click OK until you return back to the main console dialog. Ri ght click once a gain on the
main web spa c e e nt ry . Cl ick o n th e Re sta rt IIS me n u to ac ti v ate the n ew M IM E Ty pe s.
14
1414
14
ViewONE JavaScript Ov erview
The ViewONE Javascript API offers an alternative mechanism to confi gure and control the
ViewONE applet.
In many cases the use of the Javasc ript API will not be required simply becaus e most
configuration parameters can be implemented using simple H TML (see ViewONE HTML
manual).
However, where a more dynamic operation is requir ed, for exam ple, where it i s desired to
configuration parameters during the operation of View ONE, perhaps to chan ge a
document without reloading a web page, rotate a page, inver t etc then the JavaScript API
is ideal.
Additionally, traditional web viewing applications habitually reload a web page in order to
view or change the currently view ed image/document.
But with ViewONE’s extensive Image/Document open/close JavaScrip t API methods it is
possible to avoid web page refreshing entirely. This can result in significant pe rformance
improvements since all delays due to web page reh freshing (and therefore Java En gine
reloading and applet restarting) are avoided.
Daeja has produced white paper specifically addres sing per formance tuning w hich covers
the area of web page refreshing and apple t reloading. Please v isit Daeja’s w eb site to
download white papers www.daeja.com
.
Browser Note :
Please note, some browsers are case sensitive and so we adv ise the use of method
names in exactly the same case as spe cified in this manual. Failure to adhere to this may
result in methods not being called correctly.
15
1515
15
JavaScript Reference
The JavaScript examples in this manual do not refer to their use in any particul ar context.
The examples could be used within functions o f a Ja vaScript program o r directly as event
handlers to buttons, hyper-links etc. Our web site illustrates such u ses; al ternatively refer
to an appropriate JavaScript guide.
Filenames and hyperlink addresses are ex pressed using th e In ternet URL addr ess format
(Uniform Resource Locator), e.g. “http://mysite/myimage.tif”. If any part of the address
before “myimage.tif” is not included then the applet w ill assume a base addre ss that is the
same as the applet location (the codebase) .
With the exception of filenames and hyperlink addresses, all parameters a re case
insensitive.
Security note: Change sin ce Vie wONE 3. 0. 99 Standa rd and 1.0. 99 P ro
Some Javascript methods are disabled by default an d can only be enabled by setting the
JavaScripExtensions HTML parameter set to tru e .
<PARAM NAME=“JavaScriptExtensions” VALUE=“true”>
e.g.
This is to prevent unauthorized users from attempting to manipulate View ONE through
Javascript methods in or d er to obtain ac cess to sec ure
information/documents/annotations.
The methods that are restricted in this manner are clearly marked w ithin this document.
16
16
1616
General Applet Control
Method:
isReady()
E.g. var ready = ViewONE.isReady();
This method returns true if the applet as completed initialization.
If JavaScript is used to open a documen t during HTM L page initialization then this method
is useful in determining when ViewONE has fully initialized (prior to opening the
document).
Browsers normally initialize Applets in parallel to HTML initialization and so it may be
necessary to use this method to synch ronize calls to View ONE. Also, ViewONE itsel f runs
thru an initialization phase in parallel to the loading of a web page.
Note on “object not found” message…
If you receive an “object not found” message while making this (or any JavaScript
calls) then it is because the applet has not been started by the browser (ViewONE
has not even had a chance to perform it’s own initialization). This message is
produced by the browser (not the applet).
The solution is to add some JS code to the call of isReady() which handles object not
found (or any use of JavaScript with ViewONE), as follows…
17
1717
17
var appletReady = false;
var doc = parent.frames.main.document; //(or just 'document' if it's
not in a frame)
if (doc.ViewONE)
{
appletReady = doc.ViewONE.isReady();
}
if (appletReady)
{
//do something
}
Method:
The “if (doc.ViewONE)” line will result in false if the applet has yet to be started.
If you still have problems then you may want to make use of the “OnError” JavaScript
statement that allows you to set up your own error h andler. Your error handler w ill then be
called when a JavaScript problem is encountered s uch as abov e. E.g..
onerror = errorHandler;
//you code to do whatever you need to do… then…
function errorHandler()
{
//if we get here it is probably because a call has been made
//to the applet before the browser has had time to initialize it
//it can therefore be ignored
}
getVersion()
E.g. var version = ViewONE.getVersion();
Returns a String value representing the product version.
18
1818
18
Opening documents and images
Method:
Method:
openFile(filename, page)
E.g. ViewONE.openFile(“myimages.tif”, 1);
Specifies the filename and initial page of the document to be view ed.
This filename can specify either the filename relative to the code base (as abo ve) or the
full URL. The code base is specified in the HTM L code for the applet (see previous
example). An example of a full URL is as follows…
E.g. ViewONE.openFile(“http://mysite/myimages.tif”, 1);
closeDocument()
E.g. ViewONE.closeDocument();
Closes an open document.
NOTE: Closing the open document also resets annotations, annotation templates and
E.g.
ViewONE.initializePageArray(3);
ViewONE.setPageArray(“page1.tif”, 0);
ViewONE.setPageArray(“page2.tif”, 1);
ViewONE.setPageArray(“page3.tif”, 2);
ViewONE.openPageArray(1);
This method group specifies the number files (pages) in a list, then specifies each file
(each one representing a successive pa ge of the do cument), then ope ns the ‘ assembled’
document at page 1. Note the page array begins at array element z ero.
19
19
1919
Initializing the page and thumb arrays causes a ‘soft’ close to be pe rformed, i.e. the cu rrent
document is closed and the annotation source , templates and ba c kground images are
reset if a document is currently open. If no docu ment is cu rrently open, then the close and
reset is not performed.
E.g.
ViewONE.initializePageAndThumbsArray(3);
ViewONE.setPageArray(“page1.tif”, 0);
ViewONE.se tThu mbsA rra y (“p a ge1- t.ti f” , 0 );
ViewONE.setPageArray(“page2.tif”, 1);
ViewONE.se tThu mbsA rra y (“p a ge2- t.ti f” , 1 );
ViewONE.setPageArray(“page3.tif”, 2);
ViewONE.se tThu mbsA rra y (“p a ge3- t.ti f” , 2 );
ViewONE.openPageArray(1);
These methods are similar to the previous. They speci fy the number files (pages) in a list,
and then specify a separate file for each page and a thumbnail file for that page. The final
method then opens the “assembled” document at page 1 . Note, the pa ge array begins at
array element zero.
In some instances, it may be advantageous to have separate files for the thumbnails to
assist in browsing of thumbnails (smaller files are quicker to dow nload and v iew ).
Initializing the page anf thumb arrays causes a ‘soft’ close to be pe rformed, i.e. the cu rrent
document is closed and the annotation source , templates and ba c kground images are
reset if a document is currently open. If no docu ment is cu rrently open, then the close and
reset is not performed.
21
2121
21
Method
Group:
initializeDocumentA rray(numDocs)
setDocumentArray( filenam e, index)
openDocumentArray()
E.g.
ViewONE.initializeDocumentArray(3);
ViewONE.setDocumentArray(“doc1parameters.txt”, 0);
ViewONE.setDocumentArray (“doc2parameters.txt”, 1);
ViewONE.setDocumentArray (“doc3parameters.txt”, 2);
ViewONE.openDocumentArray(1);
This method group specifies the number docu ments to open in a multi-docu ment session ,
then specifies the parameter file for each do cument ( each one representing a successiv e
document), then opens the ‘assembled’ document list at document t1 . Note the docu ment
array begins at array element zero.
For information about using document paramater files, please refer to the ViewONE HTML
Installation Manual; look up the section on the “Doc<N>” H TML parameter .
Method:
Initializing the page anf thumb arrays causes a ‘soft’ close to be pe rformed, i.e. the cu rrent
document is closed and the annotation source , templates and ba c kground images are
reset if a document is currently open. If no docu ment is cu rrently open, then the close and
reset is not performed.
openList(listFile, page)
E.g. ViewONE.openList(“mylist/list.txt”, 1);
This method offers and alternative option to the page array methods above. It allow s a file
to be supplied which contains a list of pa ges.
This is useful for very large documents becau se i t removes the need to deal w ith an a rray
in JavaScript .
It can also be used to keep the H TML cons tant, by changing the sour ce list instead o f
changing the HTML between different documen ts.
(Separate files for thumbnails are not available for this option).
22
2222
22
Method:
Method:
Method
Group:
reloadList()
E.g. ViewONE.reloadList()
This method forces the list used with the openList() method to be reloaded an d the
document to be re-opened. It will reload the list file from source (i.e. the w eb s erver) each
time, so if it has changed then the changes w ill be picked up.
openDoc(index)
E.g. ViewONE.openDoc(2)
This method applies only when the “doc<N>” H TML paramete r is used ( see HTML
manual). The value of “index” represents the associ ated “doc<N>” parameter. Therefore,
the above example will cause ViewONE to open the secon d do cument in the list (i.e., that
specified by the “doc2” HTM L parameter).
These are convenience methods that can be used in place o f the “openDoc” method
described above.
getNumPages()
E.g. var numPages = ViewONE.getNumPages();
Gets the number of pages in the current d ocument ( an integer).
23
23
2323
Method:
Method:
Method:
setPage(page)
E.g. View ON E.se tP a ge( 2) ;
Sets the current page number (an integer).
getPage()
E.g. var page = ViewONE.getPage();
Returns the current page number as an inte ger.
nextPage()
E.g. ViewONE.nextPage();
Method:
Method
Group:
Convenience method to view the next page (c urrent page + 1 )
previousPage()
E.g. ViewONE.previousPage();
Convenience method to view the previous pa ge (current page - 1).
setDescription(description)
getDescription()
E.g.
var desc = ViewONE.getDescription();
ViewONE.setD esc ri ptio n(“ my Do c”);
Gets or sets the description for the document. The d escription is used w hen opening the
document in ViewONE, “Opening docXYZ…” or “Opening docXYZ, page 2….” will be
displayed in the status bar.
24
2424
24
Method:
Method:
getDocReference()
E.g.
Var ref = ViewONE.getDocReference();
Gets the document reference for the document.
getCacheFile()
E.g. var file = ViewONE.getGetCacheFile();
Returns a String value representing the local filename of the displayed image.
If the file was loaded locally then this value will be the actual local image file. If the file w as
loaded from a web server then this value w ill be the local ‘cached’ v ersion of the image file.
*Important: This file must not be locked during read operations (or deleted, renamed.
moved etc), as the applet will not be able to con tinue to use it and unp redictable results
may occur.
isCacheAccessFailed
()
Returns true i f access to the Vi ewON E cache fails. Vie wON E may atte mpt to write to more
than one location before and will only return true from this call if all attempts to w rite have
failed.
25
2525
25
Specifying an A nnot ations File
Method:
setAnnotationFile(filename)
E.g. ViewONE.setAnnotationFile(“http://mysite/myannotations.ant”);
This method sets the annotation file and must be ca lled be fore
any of the open methods
described above.
If the current document is closed after this method has been called, the anno tation file will
be reset. To avoid this, close the current document be fore setting the annotation file, as
closing of the current document can be a side effect o f calling other JavaScrip t methods,
for example, ‘initializePageArray’.
e.g.
viewONE.setAnnotationFile("http://...annotations.ant");
viewONE.openFile(“http://... m ydocument.t if” , 1);
E.g. View ON E.sa ve (“ c:/ te mp/i ma ge .ti f” );
Saves the cu rre n t d ocu me nt ( mul ti-pa g e ti ffs ), o r c u rr en t pa ge ( mul ti- fi le d o cum ents ) to the
specified filename.
If filename is null, either the save dialog is displayed or, if a server side save co mponent
has been specified, the image is sent to the serv er side componen t.
Note: The save operation does not recreate the source file, it merely copies the sou rce file
to the specified destination and renames it to the sp ecified filename.
savePage(filename)
E.g. ViewONE.savePage(“c:/temp/page.tif”);
Saves the current page to the speci fied filename.
Method:
If filename is null, either the save dialog is displayed or, if a server side save co mponent
has been specified, the image is sent to the serv er side componen t.
If the document is a multi-page tif then this method will extract the current page from the
source tif file, and create a new tif file containing only the cu rrent page.
saveSelected(filenam e)
E.g. View ON E.sav e Sel ect ed (“c: /te mp /sel ec ted .tif”);
Saves the current selected pages of a multi-page tif document.
If filename is null, either the save dialog is displayed or, if a server side save co mponent
has been specified, the image is sent to the serv er side componen t.
Note: this method is for use only with multi-page tif documents. If you are v iewing a multi-
file document then it is not possible to save selected pages from that docu ment ex cept by
individually calling the savePage() method for each page that you w ant to sav e. You may
find isMultipageTif() and getSelected() methods useful to call before calling this method.
27
2727
27
Loading...
+ 61 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.