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:
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:
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.
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:
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:
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:
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.
(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.
Here are a few recommendations to maximize the user experience when viewing DjVu content on the Web:
(under construction) |