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:
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:
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:
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.
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
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.
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.)
Here is the content of index.html:
Here is the content of menu.html:
Here is the content of onload-click.js:
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.
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:
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:
The following is an example of an embedded DjVu document:
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.
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.
Here are a few recommendations to maximize the user experience when viewing DjVu content on the Web: