Instruction/ maintenance manual of the product VERSION 3.0 JAVA Tech
Go to page of 88
ViewONE JavaScript API Manual Version 3.0 Last Up dat ed: 04 th May 2005 Copyright Dae ja Image Systems. All Rights Reserved . Email: info@daeja.com Web site: http:// www.
DAEJA IMAGE SY STEMS Contents Introduction ................................................................................................................... ............................. 7 The Applet user interface ..................................
DAEJA IMAGE SY STEMS Specifying an Annota tions File ................................................................................................. ......................... 26 setAnnotationFile(filename ) ..........................................
DAEJA IMAGE SY STEMS zoomOut() ...................................................................................................................... ..................................................... 42 zoom100() ..................................
DAEJA IMAGE SY STEMS printDocument() ................................................................................................................ .................................................. 56 printRange() ..................................
DAEJA IMAGE SY STEMS isFileKeys() ................................................................................................................... ...................................................... 75 setImageKeys(tru e /false) ................
7 7 7 7 Introduction ViewONE is a Java applet tha t extends y our web b row ser so tha t you can v iew , zoom, magnify, scroll, pan, rotate and print y our images and image do cuments quickly and easily. This document is the View ONE Jav aScript Manual and cov ers how to use and w hat options are available for the ViewONE Jav aScript API.
8 8 8 8 T he A pplet user interf ace Verti cal scroll bar Horizontal sc rol l bar Help and progress captions appear here Enhance mode Scroll to First, Previous, Next and Last Page Image Area Drag mous.
9 9 9 9 Installing ViewONE To install ViewONE on your w eb si te you must first download the ‘Upda te’ zip file from the Daeja web site. This can b e found by visitin g www.daeja.com/pub/start/dow nloads.htm l After unzipping the dow nloaded file you should have a directory na med “ v1files ”.
10 10 10 10 ViewONE Pro If you have dow nloaded Vie wO NE P r o (with or without the Print A ccelerator, Annotations, DjVu, PDF or other optional modules), then to use V iew ONE Pro on your w eb site, setup a web page containin g the following HTML… <APPLET CO DEBASE = “ .
11 11 11 11 A pple Macintosh users (HTML) ViewONE comes with a digital certificate which is re quired to permit the applet to print and provide local caching. View ONE is also Java 1.1.5 c ompliant. Apple Macintosh 9 use rs w ill need to use IE4.5 (or l ater) and Ap ple Macintosh X (10 .
12 12 12 12 Setting u p W indo ws 2003 s er v er If your server is running Windows 2003 with IIS 6, you w ill hav e to add two file extensions to yo ur w eb site “M IM E Ty p es” .
13 13 13 13 Click on the properties me nu to display the properties dialog… Click on the M IME Type button to display the M IM E Type dialog… Use the New bu tton to add tw o new M IME types….
14 14 14 14 Click OK until you return b ack to the main console dialog. Ri ght click once a gain on the main w eb 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.
15 15 15 15 ViewONE Ja vaScript Ov er view The ViewONE Javascript API offers an alterna tive mechanism to con figure and con trol the ViewONE applet. In many cases the use o f the Javasc ript API will not be re quired simply becaus e most configuration parameters can be implemented usin g simple H TML (see View ONE HTML manual).
16 16 16 16 Ja vaSc ript Ref er e nce The JavaScript examples i n this manual do not refe r to their use in any par ticular context. The examples could be us ed within functions of a Ja vaScript pro gram or direc tly as event handlers to buttons, hyper-links e tc.
17 17 17 17 General A pplet Control isRead y() E.g. var r eady = ViewONE.isReady(); This method returns true if the applet a s completed initialization. If JavaScript is used to op en a docu ment during H TML page initialization then this method is useful in determining w hen ViewONE has fully initialized (prior to opening the document).
18 18 18 18 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 } The “ if (doc.ViewONE)” line w ill result in false if the applet has yet to be started.
19 19 19 19 Opening docum ent s and images openFile(filename, pa ge) E.g. ViewONE.openFile(“myimages.tif”, 1); Specifies the filename and initial page of the docume nt to be view ed. This filename can speci fy either the filename relative to the code base (as abo ve) or the full URL.
20 20 20 20 Initializing the page and thumb ar rays causes a ‘soft’ close to be performed, i.e. the cu rrent document is closed a nd th e annotation sou rce, templates a nd bac kground images a re reset if a documen t is cur rently open. If no documen t is currently open , then th e close and reset is not per formed.
21 21 21 21 initializePag eAndThumbsA rray(numPages) setPageA rray(filename, p age) setThumbsArray (filename, pag e) openPageA rray( page) E.g. ViewONE.initializePag eAndThumbsArray(3); ViewONE.setPageArray(“page1.tif”, 0); View ONE.se tThu mbsA rra y (“p a ge1- t.
22 22 22 22 initializeDo cumentA rray(numDocs) setDocum entA rray( filenam e, index) openDocumentA rray() E.g. ViewONE.initializeDocument Array(3); ViewONE.setDocumentArray(“doc1parameters.txt”, 0); ViewONE.setDocumentArray (“doc2para meters.txt”, 1); ViewONE.
23 23 23 23 reloadList() E.g. ViewONE.reloadList() This method forces the list used w ith the openList() method to be reloaded and the document to be re-opene d. It will reload the list file from source (i.e. the web s erver) each time, so if i t has chan ged then the changes w ill be picked u p.
24 24 24 24 setPage( pag e) E.g. Vi ew ONE.se tP a ge( 2) ; Sets the current page nu mber (an in teger). getPage() E.g . va r pag e = ViewO NE. g etP ag e() ; Returns the current pa ge number as an integer. nextPage() E.g. ViewONE.nextPage(); Convenience method to v iew the next pa ge (current page + 1 ) previousPage() E.
25 25 25 25 getDocRefe rence() E.g. Var ref = ViewONE.getDocRef erence(); Gets the document reference for the document. getCacheF ile( ) E.g. var f ile = ViewONE.getGetCacheFile(); Returns a String value representin g the local filename o f the displayed ima ge.
26 26 26 26 Specify ing an A nnot atio ns File set A nnotationFil e(filename ) E.g. ViewONE.setAnnotationFile(“http://m ysite/myannotations.ant”); This method sets the annotation file and must be called be fore any of the op en m ethods described above.
27 27 27 27 Saving document s and images save( filenam e) E.g. Vi ew ON E.sa v e( “c:/ te mp/i ma ge .ti f” ); Sav es th e cu rren t d ocu me n t ( mul ti-p a ge ti ffs ), o r cu rr en t p a ge (mu lti -fi le do cum en ts ) to the specified filename.
28 28 28 28 isMultip ageTif() E.g. vat ismulti = ViewONE.isMultipag eTif(); This method is useful i f you w ant to first check w hether the cu rrent docu ment is a multi- page tif before usin g the abov e methods.If it is then this me thod returns true el se it returns false .
29 29 29 29 Document h yperlinks setHy perlink( url, dblCl ick) E.g. ViewONE.setHyperlink(“newpage.html”, false); or ViewONE.setHyperlink(“http:// mysite/newpage.html”, false); Specifies a hyperlink that is activated w hen the use r clicks on the i mage area .
30 30 30 30 PDF Vie w ing Options (Pro-Onl y) ViewONE Pro introduced an op tional PDF module. The module comes w ith v arious optional me thods as follo ws... setPDFPixelDepth(pixeldepth) E.g. ViewONE.setPDFPixelDepth(8); This method will change the de fault pixel depth w hen viewing PDF docu ments.
31 31 31 31 getPDFRes olution() E.g. v ar d e pth = Vi ew ON E. getP D FRe so lu tio n (); Returns the cu rrent resolution used w hen vi ewing PDF documen ts.
32 32 32 32 The best value for you ca n only really be dis covered by experimentation since it depends upon your docu ments, PC and netw ork performance and user p references . getAutoLimitPDFMemory Value() E.g. va r li mit = V ie w ONE .ge tAut oL imi tPD FM e mo ry Va lue () ; Returns the current limiting v alue used w hen vi ewing PDF documents.
33 33 33 33 COLD Vie w ing Options (Pro-Onl y) ViewONE Pro introduced an op tional COLD module. The COLD module is responsible for implementing i mage merging and text formatting processes. A COLD document (Co mputer Ou tput to Laser Dis k) is traditionally a docu ment that has both text and image con tent and is usually used w ith forms pac kages.
34 34 34 34 setBackgroundImage( filenam e, pageNumbe r) E.g. ViewONE.setBackgroundImage(“mybackimage.tif“, 1); This method is used to s et the C OLD background template for all pages in a d ocument. The pageNumber parama ter is used w here the file used for the bac kround sup ports multiple pages, such as TIF and PDF files.
35 35 35 35 setBackgroundImageEnabl ed(true/false) E.g. ViewONE.setBackgroundImageEnabled(false); This method is used to ch ange the visibility o f the COLD template ima ge. A value of false will remove the template from view, and a v alue of true w ill show the template.
36 36 36 36 Document Indexes (Pro-Onl y) ViewONE Version 3 introduced an option to specify a text index for mul ti-page documents. A text index acts as a n al ternative to the thumbnail pane and w ith large docu ments can offer better performance than thumbnails (due to no t having to handle ima ge decompression display).
37 37 37 37 Image invert() E.g. ViewONE.invert(); Inverts the display colors (blac k changes to w hite and visa-versa). This method is also effective on images with more than two colors. A second call to this method will re- establish the original displ ay colors.
38 38 38 38 isEnhance(true/fa lse) E.g. var enhance = View ONE.isEnhance(); Returns a Boolean ‘True’ if en hance is on , ‘False’ if it is o ff.
39 39 39 39 initializeRotationA rray(int size) E.g. ViewONE.initializeRo tationArr ay(4); Initializes the rotation array, used for setting the rotation of each page of the current ima ge, to the giv en siz e. setRotation Array(int angle, int page) E.g.
40 40 40 40 rotateClockw ise () E.g. Vi ew ON E .ro ta teCl oc kw i se() ; Convenience method to in crease the ro tation by 90 degrees. If t he document is closed when this method is called, the def ault for all pages is m odified. If the document is open when this method is called , the indivi dual page is modified only .
41 41 41 41 getFlip() E.g. var angle = ViewONE.getFlip(); Return s the flip mo de as an in tege r. setScal e(sc al e) E.g. ViewONE.setScale(0); Specifies the scale mode used to display a page. Ac ceptable integer v alues are: 0: best fit The page is scaled to fit into the w indow area so that the en tire pa ge is visible.
42 42 42 42 setStat es(st ring st at es) E.g. Vi ew ONE.se tS ta tes (s ta te s) ; Sets the zoom, scroll and other states to the values speci f ied by the coded string.
43 43 43 43 setZoom(zoom) E.g. Vi ew ONE.se tZ oo m(2 .0 ); Zooms to the v alue specified. The v alue is speci fied as a double v alue - 1.0 = 100% or 1 image pixel = 1 sc reen pixel, 2 .
44 44 44 44 setDragging Enabled( t rue/false) E.g. ViewONE.setDraggingEnabled(true); Specifies whether the d ragging o f the i mage is p ermitted or no t (using the mouse) . Dr agg ing t he im ag e to the r ig ht pan s th e im age to t he r ig ht , dr agg ing t he im age to t he lef t pans the image to t he left et c.
45 45 45 45 getBrightness() E.g. var percent = ViewONE.getBrighness(); Ret u rns th e cur r ent br ig htn es s pe rc ent ag e s ett ing (0- 1 00) . setContras t(percent) E.g. Vi ew ON E .se tCon tra s t(40 ) ; This method sets the contrast of the image displayed.
46 46 46 46 setLuminanc e(perc ent) E.g. Vi ew ON E.se tL umi na n ce(70 ); This method sets the luminance o f the ima ge displayed. The v alue represents a percentage from 0-100 , with 50 bein g the de fault value. 0 = minimu m luminance (dull) and 100 = maximum b rightness ( bright).
47 47 47 47 getImageHeight() E.g. var height = ViewONE.getIm ageHeight(); Returns an integer value representin g the hei ght of the currently display ed image in i mage pixels.
48 48 48 48 Viewing setVie w(v iew) E.g. ViewONE.setView(0); Specifies the view mode used to display pa ges of a document. This method is effective only while a documen t is open.
49 49 49 49 setA reaZoom(true/false) E.g. Vi ew ON E .se tArea Z o om (tru e ); If true, initiates the zoom-area mode. The mouse p ointer changes to a cross and the u ser can drag the mouse (usin g button one ) to selec t an area for zoo ming.
50 50 50 50 setMagnifi erInternal( tr ue/false) E.g. ViewONE.setMagnifierInternal(true); If true, displays a magnifier window internal to the di splay area.
51 51 51 51 isMagni fier() E.g. var magVisible = ViewONE.isMagnif ier(); Returns a Boolean v alue indicating the ma gnifier visibility status. toggleMagnifier() E.g. ViewONE.toggleMagnif ier(); Tog gles the ma gni fi er on /o ff. setMagFac tor() E.g. ViewONE.
52 52 52 52 isNewWindowVisible() E.g. ViewONE.setNew W indow Visible(!ViewONE.isNewWindowVisible()); Returns a Boolean v alue o f ‘true’ if the View ONE new window is v isible else a value ‘false’ is returned. setImageForeColor(co lor) E.g. V ie w ONE .
53 53 53 53 setImageB ackColo r(c olor) E.g. ViewONE.setImageBackColor(255, 255, 255) This method sets the default color used for the bac kground o f monochrome i mages. Colors are specified using the s tandard RGB v alues. showImageBa ckCo lorD ialog() E.
54 54 54 54 Labels initializeLabel s(numLabels) setLabel(pageLab el, pageLab elColor, thumb Label , thumbLabelColor, labelNum) useLabel s() clearLab els() E.g. ViewONE.initializeLabels(3) ; ViewONE.setLabel(“Page label 1”, null, “thumb 1”, null, 0); ViewONE.
55 55 55 55 Selection and clipboard selectP age(int p ageN umber) E.g. ViewONE.selectPage(4); Toggles the select p roperty on the page in a docu ment indica ted by th e “pa geNumber” parameter (available for multi-page documents only ). clearSe lecti ons() E.
56 56 56 56 Printing printPage() E.g. ViewONE.pr intPage(); Produces a print dialog to allow the user to print the current page. Security note: This meth od is disab led by default unless the “JavascriptExtens ions” parameter is s et to “ true”.
57 57 57 57 printSelect ed() E.g. ViewONE.printSelected(); Produces a print dialog to print pages selected usin g the pa ge-select menu (available for multi-page documents only). Can be us ed w ith the “selectPage(pageNumber)” and “clearSelections()” methods to print any pa ge or group of pa ges within a docum ent.
58 58 58 58 isPrintDialog( ) E.g. var dialog = ViewONE.isPrint Dialog(); Returns a Boolean ‘True’ if the print dialog is enable d, ‘False’ i f it is not.
59 59 59 59 setPrint Head er(head erSt ring) E.g. ViewONE.setPrintHeader(“$page # $o f ##”) Printouts can include cus tom text at the top o f each page. By de fault this text i s set to the page number followed by the number o f pa ges in the docu ment.
60 60 60 60 setPrintA utoRot ate (t rue/false) E.g. ViewONE.setPrintAutoRot ate(true) This parameter is only available w hen used w ith the print accele rator and only applicable when the tag multiPrint Num is set to more than 1.
61 61 61 61 T oolbars and Buttons setScrollb ars(t rue/f als e) E.g. ViewONE.setScrollbars(true); Specifies whether scrollbars will appear w hen the image is scaled to a siz e larger than the display area. A value o f ‘true’ (default) indicates sc rollbars are required and ‘f alse’ indicates they are not.
62 62 62 62 setFileButtons(true/false) E.g. ViewONE.setFileButtons(tr ue); Specifies whether the toolbar include s file buttons . A v alue of ‘ true’ (default) indicates th e buttons are visible and ‘ false’ indicates they a re not. Th e f ile b ut to ns ar e: Open , Cl ose , Sav e.
63 63 63 63 setImageB uttons(t rue/f alse) E.g. V ie w ONE .se tI ma geB u tto ns( tr ue ); Specifies whether the toolbar includes i mage buttons. A v alue of ‘true’ (default) indicates the buttons are visible and ‘ false’ indicates they are n ot.
64 64 64 64 isPrintButtons() E.g. var buttonVisible = ViewONE.isPrintButt ons(); Returns a Boolean v alue o f ‘true’ if the p rint button is v isible else a v alue ‘ false’ is returned. setInv ertBut tons(tr ue/false) E.g. Vi ew ONE.se tIn v er tB utto n s( tru e) ; Specifies whether the toolbar includes an inv ert button.
65 65 65 65 isNewWindowButtons() E.g. var buttonVisible = ViewONE.isNew W indowButtons(); Returns a Boolean v alue o f ‘true’ if the new -window button is visible else a value ‘ false’ is retu rned . setView Buttons(true/ false) E.g. Vi ew ONE.
66 66 66 66 isAllBut tons() E.g. var buttonsVisible = View ONE.isAllButtons(); Returns a Boolean v alue o f ‘true’ if the all buttons are visible else a value ‘ false’ is returned (these are file, print, image, new -window and view buttons) setPageButtons(true/fals e) E.
67 67 67 67 toggleAdjustTool() E.g. ViewONE.t oggleAdjustTool(); This met hod toggles the visibility of the adjust tool ( brightness/contrast/ luminance). setAdjustToolVisible(OnOff) E.g. ViewONE.setAdjustToolVisible(True); This method sets the vi sibility of the adjust tool (brightness/contrast/luminance).
68 68 68 68 Menus and ke ys setFile Menus(true/ false) E.g. Vi ew ONE.se tF il eM enus( true ); Specifies whether the file pop-up menus are av ailable (using mouse button 2/ 3). A value of ‘true’ (default) indicates the menus are available and ‘ false’ indicates they are n ot.
69 69 69 69 setVie wMenus( true/f al se) E.g. Vi ew ONE .se tVi ew M enu s( true ) ; Specifies whether the v iew pop-up menus a re available (using mouse bu tton 2/3). A v alue of ‘true’ (default) indicates the menus a re available a nd ‘false’ indicates they a re not.
70 70 70 70 setImageM enus( true/f alse) E.g. ViewONE.setImageMenus(true); Specifies whether the ima ge pop-up menu s are available (using mouse button 2/3). A value of ‘true’ (default) indicates the menus are available and ‘ false’ indicates they are not.
71 71 71 71 setPrint Menus(tr ue/fal se) E.g. Vi ew ON E .se tPri n tM enus (tru e ); Specifies whether the p rint pop-up menus are av ailable (using mouse button 2 /3). A v alue of ‘true’ (default) indicates the menus a re available a nd ‘false’ indicates they a re not.
72 72 72 72 setPageMenu s(t rue/fa lse) E.g. ViewONE.setPageMenus(true); Specifies whether the pa ge pop -up menus a re av ailable (using mouse bu tton 2/3). A v alue of ‘true’ (default) indicates the menus a re available a nd ‘false’ indicates they a re not.
73 73 73 73 setSe lectMenus (true/false) E.g. ViewONE.setSelectMenus(true); Specifies whether the sele ct pop-up menus a re available (using mouse bu tton 2/3). A value of ‘true’ (default) indicates the menus are available and ‘ false’ indicates they are not.
74 74 74 74 setPref erenc eMenus(t rue/f alse) E.g. ViewONE.setPreferenceM enus(true); Specifies whether the p reference pop -up menus a re av ailable (using mouse button 2 /3). A value of ‘true’ (default) indicates the menus are available and ‘ false’ indicates they are not.
75 75 75 75 setA llM enus(true/f alse ) E.g. ViewONE.setAllMenus(true); Specifies whether the all p op-up menus are av ailable. A value o f ‘true’ (de fault) indicates the menus are available and ‘ false’ indicates they ar e not.
76 76 76 76 setImageK ey s( true/f alse) E.g. V iew ONE .se tIma ge K ey s(tru e ) ; Specifies whether the ho t keys for i mage ope rations are enabled. A v alue of ‘ true’ (default) indicates the keys a re enabled and ‘false’ i ndicates they are no t.
77 77 77 77 setPrintKe ys(true/false ) E.g. ViewONE.setPrintKeys(true); Specifies whether the ho t keys for print opera tions are enabled. A value o f ‘true’ (default) indicates the keys are ena bled and ‘false’ indicates they are not.
78 78 78 78 isV iewKe ys() E.g. var keysEnabled = Vi ew ONE.isViewKeys (); Returns a Boolean v alue o f ‘true’ if the keys are ena bled else a value ‘ false’ is returned. setPageKey s(tr ue/false) E.g. Vi ew ON E.se tP a geKe y s(tru e ); Specifies whether the ho t keys for pa ge operations are enabled.
79 79 79 79 isSelectKey s() E.g. var keysEnabled = ViewONE.isSelectKeys (); Returns a Boolean v alue o f ‘true’ if the keys are ena bled else a value ‘ false’ is returned. setA llK eys( true/false) E.g. Vi ew ON E.se tA ll Ke y s(true ) ; Specifies whether the all h ot keys ar e enabled o r not.
80 80 80 80 T imeout/User Idl e Control setTimeout(seconds) E.g. var r eady = ViewONE.setTimeout(30); This method sets and s tarts a usa ge timer. If the use r does n ot use the ap plet for the number of seconds speci fied then the applet w ill automatically be disabled.
81 81 81 81 getTimeLeft() E.g. var ti mel eft = Vi ew ONE .get Tim eLe ft( ); This method returns the time in sec onds le ft before the applet times-out. but o nly if the setTimeout() method or H TML tag “timeout” has been used to set the time in th e first place.
82 82 82 82 The Event Handler and E vent Handling ViewONE introduces the concept o f applet Jav aScript event handlin g. This is a mechanism by w hich it is possible to use JavaScript to monitor user ac tivity and other selected actions perfo rmed by the View ONE applet.
83 83 83 83 Event s handler chang e in Vie wONE Version 3 Prior to ViewONE Version 3, all events w ere signaled irrespective o f whether the event was required. However, Version 3 in troduced an ev ent filter so that o nly those ev ents that are desired are signaled to the ev ent handler.
84 84 84 84 Event s ids and de script ions ViewONE can signal man y different events to the event handler. The following list describes the ev ents that w ill be received by this function (ov er page)…and the nex t pa ge after provides a full example.
85 85 85 85 event to switch focus to any alternative component on your web page. 22 ready The applet has just been started and i s ready to accept JavaScript calls. 23 annotation hyperlink The user has activated an annotation (JavaScript) hyperlink (see annotations configuration manual).
86 86 86 86 - Windows mai n menu key - Popup menu key The following keys w ill generate eve nts but w ill a lways also be handled b y ViewONE event when ProcessKeys is set to False… - Scroll bar key.
87 87 87 87 Event Handler examp l e: <html> <head> <title>ViewONE Event Handler Demo</title> </head> <body bgcolor="#C0C0C0" text="#000000" to pmar.
88 88 88 88 Testing y our Event Handler There may be ca ses w here ‘LiveConnect’ is not im plemented (older brow sers or some browser implementations on non -MS W indows platforms) w hich w ill mean JavaScript cannot call applet methods and the event handle r functionality w ill not work.
An important point after buying a device JAVA Tech VERSION 3.0 (or even before the purchase) is to read its user manual. We should do this for several simple reasons:
If you have not bought JAVA Tech VERSION 3.0 yet, this is a good time to familiarize yourself with the basic data on the product. First of all view first pages of the manual, you can find above. You should find there the most important technical data JAVA Tech VERSION 3.0 - thus you can check whether the hardware meets your expectations. When delving into next pages of the user manual, JAVA Tech VERSION 3.0 you will learn all the available features of the product, as well as information on its operation. The information that you get JAVA Tech VERSION 3.0 will certainly help you make a decision on the purchase.
If you already are a holder of JAVA Tech VERSION 3.0, but have not read the manual yet, you should do it for the reasons described above. You will learn then if you properly used the available features, and whether you have not made any mistakes, which can shorten the lifetime JAVA Tech VERSION 3.0.
However, one of the most important roles played by the user manual is to help in solving problems with JAVA Tech VERSION 3.0. Almost always you will find there Troubleshooting, which are the most frequently occurring failures and malfunctions of the device JAVA Tech VERSION 3.0 along with tips on how to solve them. Even if you fail to solve the problem, the manual will show you a further procedure – contact to the customer service center or the nearest service center