[DjVu Zone]
  DjVu Zone
  What's New
  What is DjVu
  Digital Libraries
  DjVu on the Web
  DjVu Companies
  Technical Papers
  Search DjVu Zone
[Get the Plug-in]
[get the plug-in]
-About this Tutorial
-What is DjVu
-The Many Faces of DjVu
-When to use DjVu, and what performance to expect?
-The Main Features of DjVu
Creating DjVu Documents: a Quick Introduction
-Working with DjVu Files
-Images, Resolution, and Scanning
-Overview of the DjVu Compression Software
-Compressing Individual Images
-Creating Multipage DjVu Documents
-Compressing Multiple Images into a Multipage DjVu Document
-Hyperlinks and Annotations
Publishing DjVu Documents on the Web
-Introduction: Getting Started
-Simple CGI-style arguments
-Displaying a DjVu Documents in a Frame
-Embeding DjVu Documents into HTML Pages
-Elements of Style
-Linking to the DjVu Web Site
-A complete Example using Frames
-A complete Example using Embedded Objects
Hosting DjVu Documents: Avanced Topics
-Triggering the Automatic Plug-in Download
-Automatic Installation of the Plug-in: how does it work?
-DjVu Display Attributes
-Attributes in the URL
-How Caching Works
Configuring your Web Server for DjVu
-Multipurpose Internet Mail Extensions (MIME)
-Configuring Your Web Server to Support DjVu
The DjVu File Structure
DjVu: A Tutorial

Publishing DjVu Documents on the Web

Introduction: Getting Started

The real power of DjVu is seen when you publish content on the web. There are many different ways to publish DjVu content on the web. The simplest ones are described in this chapter. More advanced topics are discussed in the next chapter.

The simplest way to put DjVu documents on your web site is to link to them directly as if they were another HTML page:

<a href="my_DjVu_file.djvu">Link Name</a>
When the user clicks on the above link, the DjVu file is displayed in the current browser window. It is often convenient to display the DjVu document in a separate window. To do this, add a target attribute to your link:
<a href="my_DjVu_file.djvu" target="my_display_window">Link Name</a>
If there is a browser window or frame called my_display_window, the DjVu document will be displayed in it. If not, a new browser window will pop up showing the DjVu document.

Optional arguments can be added to the URL of a DjVu document to control the behavior of the plug-in, such as flipping to a specific page of a multipage document or showing the document at a given zoom factor. Here is an example:

<a href="my_DjVu_file.djvu?djvuopts&page=4&zoom=100%" target="my_display_window">Link Name</a>
This will show page 4 of my_DjVu_file.djvu at the 100% zoom factor. The DjVu plug-in accepts many such arguments. A complete list for the version 3.0 of the plug-in is available here.

Using this feature, you can display the DjVu document in the main window and display a table of content, an index, or a navigation tool in a different window or a side frame. A complete example of how to display a DjVu document using frame is described in the following section.

The above examples do not work well for MacIntosh users because of an annoying bug in the Mac version of Netscape and IE (frames with plug-in content are not refreshed properly). A simple workaround using JavaScript is given in the complete example described in the following section.

Making Sure your Web Server Knows about .djvu

Before trying out the above examples, you must make sure that your Web server recognizes the DjVu file type. If it does not, users of Netscape or Opera who visit your site will see gibberish on their screen instead of DjVu images. MS-IE users will be OK as long as the DjVu file name extensions are ".djvu" or ".djv".

Chances are your ISP's Web server already supports the DjVu file type. If not, and if your Web server runs Apache (which is likely), simply put a file named .htaccess in the directory that holds the djvu file. The .htaccess file must contain the following line:

AddType image/x.djvu djvu djv
To verify that your Web server runs Apache, go to this site and type your URL in the form.

The best long-term solution however is to ask your Webmaster to configure your Web server to support DjVu (or to do it yourself). It can be done in less than one minute, here is how.

The following sections discuss and explain the various ways to integrate DjVu content into your web pages.

Linking to the DjVu Web Site

Whenever you use DjVu in a web site, you can link to the DjVu web site using the DjVu logo graphic. AT&T offers a number of different logos. Choose the one that is best for your site. Use the logo to link to either the home page, http://www.djvu.com/home/index.html, or the download page, http://www.djvu.com/download/ if you do not use the automated download. This allows your user to get the plug-in so they can view your content or learn more about DjVu. (Support for automatically downloading the plug-in is described later.)

A Complete Example using Frames

Here is the content of index.html:

<html><title>My Title</title>
<frameset cols="140,*" noresize frameborder=no border=0>
<frame name="menu" src="menu.html">
<frame name="body" src="index.djvu?djvuopts&page=1">
Here is the content of menu.html:
<script language="JavaScript" src="onload-click.js"></script>
<h3>My Document</h3>
<a href="index.djvu?djvuopts&page=1" target="body">page 1</a><br>
<a href="index.djvu?djvuopts&page=2" target="body">page 2</a><br>
<a href="index.djvu?djvuopts&page=3" target="body">page 3</a><br>
<a href="index.djvu?djvuopts&page=4" target="body">page 4</a><br>
Here is the content of onload-click.js:
function onload() {
if (document.links) {
for(var i=0;i<document.links.length;i++) {
if(document.links[i].onclick == null &&
document.links[i].href != null &&
document.links[i].target != null) {
if (document.links[i].target.charAt(0) != '_' &&
parent != null && parent[document.links[i].target] != null &&
parent[document.links[i].target].location != null) {
document.links[i].onclick=new Function('parent["'+document.links[i].target+'"].location.href="'+document.links[i].href+'";return false;');
} } } } }
Keep in mind that, since most search engines do not index the content of framesets, the content of your menu file may not be referenced.

Embeding DjVu Documents into HTML Pages

A good way to integrate DjVu content on your web page is to use the EMBED or OBJECT directives in HTML. An advantage of this method is that it will work even if your ISP does not support the DjVu MIME type (and does not respond to your request to do so). Here is an example:

<embed src="my_DjVu_file.djvu" type="image/x.djvu" width="100%" height="100%">
<img src="myAlternative.jpg" width="100%" height="100%">
This method will work with all browsers supported by the DjVu plug-in except Internet Explorer 4.0 without the Y2K updates. To support the original IE 4.0, use:
<object classid="clsid:0e8d0700-75df-11d3-8b4a-0008c7450c4a" width=100% height=100%>
<param name="imageURL" value="my_DjVu_file.djvu" >
<embed src="my_DjVu_file.djvu" type="image/x.djvu" width="100%" height="100%">
<img src="myAlternative.jpg" width="100%" height="100%">

The following is an example of an embedded DjVu document:

This may seem like a lot of tags for one operation, but in order to embed your DjVu document so it can be viewed by both Internet Explorer 4.0 and Netscape Navigator you need both the <object> and <embed> tags respectively. Use <noembed> to provide an alternative graphic in case your user doesn't have the plug-in. Later, we'll discuss how to automatically download and install the plug-in from our site.

Note that you have to specify the width and height of the object or nothing will appear in Internet Explorer or a very small object will appear in Navigator. The dimensions can be specified in percentages of the object size as in the example or as pixels by dropping the percent (%) sign. However, do not specify a percentage if the document is contained in a varible sized table cell, that is, a cell whose width is not specifically defined. Both the <object> and <embed> tags also support the attributes align, hspace, vspace, border, and style. For more information on the use of these tags, refer to the HTML specification at the Worldwide Web Consortium or the HTML documentation section of your browser manufacturer's web site.

If you know your site will be accessed by a specific browser version (such as on an intranet) you can choose the best technique for that browser. However, if you want to provide your content to the largest number of possible users on the web without restricting them to the latest browser type, you may want to use the proprietary tag <embed> which has the most consistent implementation amongst the most browsers. AT&T recommends using <embed> for including DjVu documents in web pages until such a time that the <object> tag is consistently supported.

So why use the <object> tag? As you will see in the next section, automating the plug-in download requires <object> for Internet Explorer and <embed> for Navigator.

Controlling the Plug-In with URL Arguments

(under construction)

In the previous sections, we briefly mentioned how to append arguments to the URL of a DjVu document so as to control the behavior of the plug-in (e.g. mydocument.djvu?djvuopts&page=4). In this section we explains how this feature works and what it can be used for.

Strings separated by ampersands, and appended to a URL after a question mark is a standard way of passing arguments to a CGI script on the server. DjVu uses these arguments in the client (browser) to control the behavior of the plug-in.

Elements of Style

Here are a few recommendations to maximize the user experience when viewing DjVu content on the Web:

  • Do not set the size of an embedded DjVu image to a fixed size unless you really mean it. Users with high resolution displays tend to be very annoyed when they are forced to look at an image or a document through a small window embedded in the web page. Set the size of embedded DjVu images with a percentage of the window size rather than with an absolute number of pixels.
  • Use the multipage format whenever possible. Use the INDIRECT format for documents with more than a few dozen pages.
  • maximize the screen real estate allocated to the DjVu document. Minimize the space used by banners, buttons, and navigational aids.
  • keep in mind that accessing pages through CGI scripts breaks the caching mechanisms.
  • link to individual pages of an multipage document through a "page=" attribute in the URL, and not though direct links to individual page files.

A complete Example using Embedded Objects

(under construction)

DjVu Zone Search DjVu Zone Feedback
What's New What is DjVu Tutorial Documentation Digital Libraries DjVu on the Web
DjVu Companies Applications Downloads Benchmarks Technical Papers www.djvu.com

Copyright 1998-2000 AT&T All rights reserved.
DjVu and the LizardTech logo are trademarks of LizardTech Inc.
DjVu, document imaging, image compression, scan, image, document, web,image processing, digital library, electronic commerce, legacy document, plug-in, JPEG, TIFF, PDF
DjVu: The Technology for Scanned Documents on the Web
technology document image compression innovation,
scan high-resolution page color 300 dpi,
fast download of scanned documents, as fast as html,
zcoder, z-coder, binary adaptive arithmetic coding, wavelet, pattern matching.
download, free, non-commercial, plug-in, plugin, compressor, wavelets