|
|
We offer a piece of JavaScript code to detect automatically the browser
type and correctly execute the download and installation. Include the
script in the <head> of your web page or before the first
appearance of a DjVu document as follows:
<script language="JavaScript" src="http://www.djvu.com/plugins/TriggerUpdate.js"> </script>
|
This script also includes a function to embed automatically a DjVu
document using JavaScript. Add the following code to your page where
you want your DjVu document to appear:
<script language="JavaScript">
<!--
EmbededDjVu("my_DjVu_file.djvu","height","width","attributes");
// -->
</script>
|
To avoid overwhelming our servers, only include the script in the
first page where DjVu documents appear. If you would like to include
the EmbededDjVu function throughout your site, you can download the
script and host it on your server by right clicking here and
choosing Save As.
The previous procedure requires that your users
have JavaScript enabled. Therefore you should state this to warn your
users that they must have JavaScript enabled somewhere before your
DjVu page. |
Different browsers require different file formats to perform an
automatic download and installation of the plug-in. Internet Explorer
requires a .cab file and Navigator requires a .jar file. The easiest
way to accomplish this is to use the built-in features of both the
<object> tag and the <embed> tag that
allow you to automatically download the plug-in from our web site.
<object classid="clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a"
width=100% height=100%
codebase= "http://www.djvu.com/plugins/DjVuControl.cab#version=3,0,0,0">
<param name="imageURL" value="my_DjVu_file.djvu" >
<param name="flags" value="attribute=value attribute=value">
- <embed type="image/x.djvu"
src="/plugins/welcome.djvu" height="100%" width="100%"
pluginspage="http://www.djvu.com/plugins/SmartUpdate.html?
http://www.yourdomain.com/my_DjVu_file.djvu"
flags="attribute=value attribute=value"
</embed>
</object>
|
| Note:
The values for codebase and pluginspage are broken over two lines in the previous
example for display only. Your code should not contain spaces or
returns or your results could be inconsistent. |
If your navigation is such that your visitors enter via a single
page, include the automatic download method solely on that page,
thereafter you can use simpler linking and embedding methods
throughout your site.
If you would like to host the automated installation files on your
own site, you can download the files by right clicking on the
following and choosing the Save As option from the pop-up menu:
The DjVu plug-in supports a number of attributes that affect how the
DjVu document is displayed within the HTML document. While attributes
can be specified separately, AT&T recommends using the flags
attribute and group the attributes:
<object classid="clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a"
width=100% height=100%>
<param name="imageURL" value="my_DjVu_file.djvu" >
<param name="flags" value="attribute=value attribute=value">
<embed src="my_DjVu_file.djvu" type="image/x.djvu" width="100%" height="100%" flags="attribute=value attribute=value">
</embed>
<noembed>
<img src="myAlternative.jpg" width="100%" height="100%">
</noembed>
</object>
|
Note that you have to specify the attributes for both sets of tags.
The following attributes accept true,
yes, false, or no
as values. The default is true/yes
unless otherwise specified:
- toolbar
- Determines whether the toolbar is displayed in the DjVu document area.
- scrollbars
- Determines whether scrollbars are used when the document exceeds the size of the DjVu document area. If disabled, the user scrolls the document using the mouse and the hand cursor.
- menu
- Determines whether the pop-up menu is enabled.
- frame
- Determines if a gray border is drawn around the window.
- keyboard
- Determines whether keyboard input is accepted.
- passive
- Sets the zoom factor to "Fit Page" and disables toolbar, popup menu, scrollbars and keyboard input. You can enable any of the previous options, append the specific setting such as menu=true. Regardless of whether you set this value to true or false the effect is the same. By default this is not in effect.
- links
- Determines if hyperlinks are enabled.
- logo
- Determines if the "DjVu" logo displays in the background of the DjVu document area before the document loads.
- thumbnails
- Determines whether thumbnails are displayed for multiple page DjVu documents.
The following example has toolbar, menu, and scrollbars turned off and zooms to fit the page:
DjVu supports the following additional attributes and values:
- zoom
- Determines the initial zoom of the DjVu document.
Valid values are:
| one2one | fullsize |
| width | width of the DjVu document area |
| page | zooms to show entire page |
| stretch | stretches the document to fill the area specified by the width and height attributes |
| 5 to 999 | percent of zooming based on DPI of display |
The following is the previous example zoomed to 50:
- mode
- Determines the initial display mode.
Valid values are:
| color | Full color |
| bw | Black and white only |
| fore | Displays the foreground layer | /tr>
|---|
| back | Displays the background layer | /tr>
|---|
The following uses all default values, but sets the initial view to black and white. Use the Display command from the pop up menu to see the different mode effects.
- page
- Displays the specified page, which may be any valid page number in the DjVu document.
- highlight
- Creates rectangular highlighted area with given coordinates and
specified color. Five arguments separated by commas make up the
correct value, as follows:
- 1st is the X coordinate of the lower-left corner of the highlighted rectangle in document's coordinate system.
- 2nd is the Y coordinate of the lower-left corner of the highlighted rectangle in document's coordinate system.
- 3rd is the width of the highlighted rectangle.
- 4th is the height of the highlighted rectangle.
- 5th is the highlighting color in RRGGBB format. A special value of FF000000 means to use XOR highlighting. The color may be omitted, in which case XOR highlighting will be assumed.
The following example shows a highlight setting of "1000,300,1000,400,0000FF" with the passive attribute set to true:
You can specify more than one highlight attribute. In a multiple page
documents, all highlights are applied to the first page or the page
specified with the page attribute.
Note, that all the coordinates are internal document coordinates,
not screen coordinates.
- flags
- You can specify any of the attributes in matched pairs, separated by
spaces with the whole enclosed in double quotes("). To hide the
toolbar and stretch the document to fit, use:
<embed src="my_DjVu_file.djvu" type="image/x.djvu" width="100%" height="100%" flags="toolbar=false zoom=stretch">
</embed>
<noembed>
<img src="myAlternative.jpg" width="100%" height="100%">
</noembed>
|
You don't have to use the <embed> or <object> tags to use the display
attributes. The DjVu plug-in supports passing display parameters like
CGI arguments using the standard anchor (a) tag. After specifying the
DjVu document, follow it with a question mark (?) and the tags you want separated by
ampersands (&). This is an
excellent opportunity to use the flags attribute as follows:
|
<a href="my_DjVu_file.djvu?flags='passive=true page=5'">
|
(under construction)
(under construction)
|