NSDEJAVU(1)
β¨ NSDEJAVU(1) β¨
okay bestie, sit down, we're talking about nsdejavu from the DjView-4 era π
this one's the DjVu browser plugin, and honestly? it's giving vintage. it's giving before your time. but it ate, and we're gonna learn it π«Ά
πΈ SYNOPSIS πΈ
/usr/lib64/mozilla/plugins/nsdejavu.so
like, that's it. that's the whole synopsis. she's just a shared library sitting in the plugins folder, living her truth β¨
π WARNING π
ngl, using nsdejavu as a plugin in 2020 is very difficult, and I need you to hear me on this. popular browsers either straight-up don't support netscape plugins anymore (looking at you, chrome π), or they removed support for every netscape plugin except flash (yep, firefox, I said what I said).
and likeβ¦ the maintainers regret this. genuinely. because djview/nsdejavu is a perfect example of a very well behaved plugin that would have been easy to support π not me getting emotional over a deprecated plugin architecture fr fr.
so bestie, if you're on a modern browser and this doesn't work: that's not you, that's the ecosystem. π
π¦ DESCRIPTION π¦
The shared library nsdejavu.so uses the Netscape browser plugin API to display DjVu images in a number of popular web browsers. (yes, in a number of popular web browsers, that part is real, we're not rewriting history here π
)
how does it do it? iconic behavior actually: it works by invoking a standalone viewer out-of-process with the special command line option -netscape. main character energy, no cap.
and then there's a whole little search quest for which viewer to use, and it goes like this:
- it first searches a program named
djview - if that program cannot be found, it searches for
djview4 - and finally
djview3
β¨ but β¨ it is always possible to override this search strategy by setting the environment variable NPX_DJVIEW to the full path of the desired executable. so if you wanna be the one in charge, you can be. periodt.
π MIME TYPES AND EXTENSIONS π
Typing the URL of a recognized DjVu document in your web browser should automatically invoke the DjVu browser plugin. that's the dream, that's the vibe.
but here's the thing: each browser uses different methods to determine that a particular URL is in fact a DjVu document. messy, but we deal π
Web server normally provide a MIME type to web browsers. The official MIME type for DjVu documents is image/vnd.djvu. π
For compatibility with ancient versions of the DjVu viewer, it is common to use instead the experimental MIME type image/x-djvu or image/x.djvu. (experimental!! how very avant-garde of them β¨)
Web servers should be configured to send the proper MIME type for DjVu documents. and also, most web browsers recognize files ending with .djvu or .djv as DjVu files, so that's your little safety net π«Ά
π how to vibe check your server π
An easy way to check if an http server is giving an appropriate content-type is to invoke the following command with a URL corresponding to an actual DjVu file on the server:
curl -u URL | grep Content-Type
The result should be one of the following, preferably the first:
Content-Type: image/vnd.djvu
Content-Type: image/x.djvu
Content-Type: image/x-djvu
Any other MIME type indicates a server misconfiguration. π like, red flag, bestie. red flag.
π CGI-STYLE FLAGS π
okay so this is the fun part. The behavior of the DjVu browser plugin can be specified by augmenting the URL using a syntax similar to that used by the CGI programs. and the template goes a lil something like this:
http://.../file.djvu?djvuopts&keyword=value&keyword=value&...
π¨ important π¨ The DjVu browser plugin only recognizes keywords that appear after the word djvuopts. if you forget djvuopts, she's not listening. she's not even looking at you.
The keywords recognized by each viewer are listed in the corresponding man page. Unrecognized keywords are ignored β no error, no drama, just silence π
The most common keywords are:
page=pagenameβ Specify which page is displayed by name or by ordinal number.zoom=zoomfactorβ Set the zoom factor. Legal values for zoomfactor are:numberβ Magnification factor in range10%to999%.one2oneβ Select the"one-to-one"mode.widthβ Select the"fit width"mode.pageβ Select the"fit page"mode.stretchβ Stretch the image to the plugin window size.
π BROWSER COMPATIBILITY π
The DjVu browser plugin has been tested with several popular web browsers, and the roster is lowkey a time capsule π°οΈ
- Netscape 4 and 6
- Gecko based browsers such as Mozilla, Galeon and Firefox
- KHTML based browsers such as Konqueror
- Opera
Please read the browser documentation to find out where the plugin library should be installed. (yes really, go read the docs, I'm not gonna guess for you π«Ά)
π EMBEDDING DJVU IMAGES IN HTML PAGES π
You can integrate DjVu content on an HTML web page with either the <embed> or the <object> tag. and here's the slay part: this method will work even if your web server does not support the DjVu MIME type π₯
The CGI style flags can be directly used as attributes of the embedding tag. chef's kiss.
The following example shows the W3C standard syntax with the OBJECT tag:
<object data="myfile.djvu" type="image/vnd.djvu"
width="100%" height="100%" >
<param name="page" value="iii">
<param name="zoom" value="stretch">
This browser cannot render djvu data.
</object>
And this is the customary syntax with the EMBED tag:
<embed src="myfile.djvu" type="image/vnd.djvu"
width="100%" height="100%"
page="iii" zoom="stretch"></embed>
pick your fighter, both are valid π
π§ INTERFACING THE DJVIEW PLUGIN WITH JAVASCRIPT π§
okay now we're getting scriptable. Recent versions of the djview4 plugin can be controlled from the JavaScript interpreter of browsers implementing the Mozilla NPRuntime API. (iykyk)
To access the plugin object, include the attribute id="pluginname" into the <object> or <embed> tag and use the JavaScript function getElementById("pluginname").
The plugin object implements two methods to retrieve and set the value of the options usually recognized as CGI-style flags. It also can evaluate a specified JavaScript expression whenever something changes in the status of the djview interface. multitasking icon π
pluginobject.setdjvuopt("key",value)β Set the value of the djvu option key to the character string value. This achieves the same effect as specifying optionkey=valueamong the CGI-style flags. For instance, values of the keypagecan be page IDs, page titles, page numbers, or page names.pluginobject.getdjvuopt("key")β Return the value of the djvu option key as a string. The returned value is always a character string, even when the return is logically a number. Boolean values are returned as stringsyesorno. Besides the usual CGI-style flags, this function recognizes the additional keypagesand returns the total number of pages in the DjVu document. An empty string is returned when the key is not recognized. πpluginobject.onchange="code";β Ensure that string code is evaluated in the context of the plugin object whenever something changes in the djview graphical user interface. For instance, this evaluation happens when progressive refinements are painted, and when the user manipulates the image interactively.pluginobject.versionβ Return a string describing the plugin version. This property can be used to test whether the djview plugin is scriptable in this browser.
β οΈ heads up bestie: Note that the scriptability feature may not be accessible until the djview plugin is fully loaded. Therefore it is advisable to checkpluginobject.versionfrom the JavaScriptonloadbefore calling any other method. do not skip this step, I'm begging π
π CREDITS π
This program was written by Andrei Erofeev <andrew_erofeev@yahoo.com> and was then improved by Bill Riemers <docbill@sourceforge.net> and LΓ©on Bottou <leonb@users.sourceforge.net>. absolute legends, all three π
π«Ά SEE ALSO π«Ά
and that's the whole page, bestie!! π this little love letter to a netscape plugin era came to you from DjView-4, dated 1/4/2007 β yes, 2007, she's vintage vintage, and we respect her for it πβ¨ππ¦πΈ
π¦ where this page comes from
- fedora 43: djview4-plugin 4.12-14.fc43 Β· GPL-2.0-or-later
- fedora 43: djview4-plugin 4.12.3-1.fc43 Β· GPL-2.0-or-later
- fedora 44: djview4-plugin 4.12-16.fc44 Β· GPL-2.0-or-later
- fedora 44: djview4-plugin 4.12.3-1.fc44 Β· GPL-2.0-or-later
- Copyright (c) 2001 Leon Bottou, Yann Le Cun, Patrick Haffner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms