DJVUXML(1)
π DJVUXML π
ok so real talk bestie, this is the manual for DJVUXML(1) from the DjVuLibre XML Tools crew β two little programs, djvutoxml and djvuxmlparser, and they are literally the moment for anyone who wants to mess with their DjVu files through XML instead of raw tooling. iykyk β¨
πΈ NAME πΈ
djvutoxml, djvuxmlparser β DjVuLibre XML Tools, periodt.
π SYNOPSIS π
djvutoxml [options] inputdjvufile [outputxmlfile]
djvuxmlparser [ -o djvufile ] inputxmlfile
β¨ DESCRIPTION β¨
The DjVuLibre XML Tools are your besties for editing the metadata, hyperlinks, and hidden text that live inside DjVu files. π¦
And the way this is different from djvused(1)?? Unlike djvused(1), the DjVuLibre XML Tools are fully built on XML technology, which means you get to flex with all your fave XML editors and verifiers. it's giving β¨interoperabilityβ¨. slay.
π§ DJVUTOXML π§
So djvutoxml is the one that makes the XML. It creates an XML file called outputxmlfile, and that file contains:
- a reference to the original DjVu document
inputdjvufileπ - tags describing the metadata associated with the DjVu file
- tags describing the hyperlinks associated with the DjVu file
- tags describing the hidden text associated with the DjVu file
The following options are supported, no cap:
--pagepagenum β picks one page out of a multi-page document. and if you don't pass this? thendjvutoxmljust outputs the XML for all pages of the document. main character energy, honestly.--with-textβ says theHIDDENTEXTelement for each page should be included in the output. β οΈ but listen: if you specify this without the--with-annoflag, then--without-annois implied. and if none of--with-text,--without-text,--with-anno, or--without-annoare specified, then--with-textand--with-annoare both implied.--without-textβ says not to output theHIDDENTEXTelement for each page. if you specify this without the--without-annoflag, then the--with-annoflag is implied.--with-annoβ says the areaMAPelement for each page should be included in the output. if you specify this without the--with-textflag, then the--without-textflag is implied.--without-annoβ says the areaMAPelement for each page should not be included in the output. if you specify this without the--without-textflag, then the--with-textflag is implied.
bestie these flag implications are a whole web of vibes. read them twice, fr fr. π
π DJVUXMLPARSER π
ok so once djvutoxml hands you a file, you can go in and edit it β either with a plain text editor or with a full XML editor, whichever is your era. π
Then djvuxmlparser is the one that reads it back in. It parses the XML file inputxmlfile in order to modify the metadata of the corresponding DjVu file.
-odjvufile β in principle, the target DjVu file is whatever file is referenced by theOBJECTelement of the XML file. but this option gives you the power to override the filename specified in theOBJECTelement. iconic override behavior, we love to see it.
π DJVUXML DOCUMENT TYPE DEFINITION π
The document type definition file β the DTD, if you're fancy β lives right here:
/usr/share/djvu/pubtext/DjVuXML-s.dtd
and this is what defines the input and output of the DjVu XML tools. β
The DjVuXML-s DTD is a simplification of the HTML DTD:
http://www.w3c.org/TR/1998/REC-html40-19980424/sgml/dtd.html
...with a few new attributes added that are specific to DjVu. π
Here's the tea on the structure: each of the specified pages of a DjVu document is represented as OBJECT elements within the BODY element of the XML file. Each OBJECT element may contain multiple PARAM elements to specify attributes like page name, resolution, and gamma factor. Each OBJECT element may also contain one HIDDENTTEXT element to specify the hidden text (usually generated with an OCR engine) within the DjVu page. And on top of all that, each OBJECT element may reference a single area MAP element which contains multiple AREA elements to represent all the hyperlink and highlight areas within the DjVu document. π¦
π PARAM Elements π
Legal PARAM elements of a DjVu OBJECT include but are not limited to:
PAGEβ for specifying the page-nameGAMMAβ for specifying the gamma correction factor (normally2.2)DPIβ for specifying the page resolution
π HIDDENTEXT Elements π
The HIDDENTEXT elements consist of nested elements of PAGECOLUMNS, REGION, PARAGRAPH, LINE, and WORD. β¨
The most deeply nested element specified should specify the bounding coordinates of the element in top-down orientation. The body of the most deeply nested element should contain the text.
Most DjVu documents use either LINE or WORD as the lowest level element, but β and this is important bestie β any element is legal as the lowest level element.
A white space is always added between WORD elements, and a line feed is always added between LINE elements. π₯
Since languages such as Japanese do not use spaces between words, it is quite common for Asian OCR engines to use WORD as characters instead. no cap, that's just how it be.
π MAP Elements π
The body of the MAP elements consists of AREA elements. π
In addition to the attributes listed in:
http://www.w3.org/TR/1998/REC-html40-19980424/struct/objects.html#edef-AREA
...the attributes bordertype, bordercolor, border, and highlight have been added to specify border type, border color, border width, and highlight colors respectively. Legal values for each of these attributes are listed in the DjVuXML-s DTD. π
In addition, the shape oval has been added to the legal list of shapes. An oval uses a rectangular bounding box. that's right, an oval with a rectangular bounding box β not me questioning the geometry, it's just what the DTD says. π
π BUGS π
Perhaps it would have been better to use CC2 style sheets with standard HTML elements instead of defining the HIDDENTEXT element.
(the devs said it, not me π)
π CREDITS π
The DjVu XML tools and DTD were written by Bill C. Riemers <docbill@sourceforge.net> and Fred Crary. absolute legends, we stan. π
π SEE ALSO π
djvu(1), djvused(1), and utf8(7). go read them next, bestie, you know you want to. π«Ά
and that's the whole thing! this page was brought to you by DjVuLibre XML Tools, dated 11/15/2002 β yeah she's vintage but she still eats πβ¨ππ¦πΈ
π¦ where this page comes from
- alpine 3.24: djvulibre-doc 3.5.30-r0 Β· GPL-2.0-only
- arch rolling: djvulibre 3.5.30.1-1 Β· GPL-2.0-or-later
- debian bookworm: djvulibre-bin 3.5.28-2.1~deb12u1
- debian bookworm: djvulibre-bin 3.5.28-2.2~deb12u1
- debian trixie: djvulibre-bin 3.5.28-2.2
- epel 10: djvulibre 3.5.28-13.el10_0 Β· GPL-2.0-or-later
- epel 9: djvulibre 3.5.28-4.el9 Β· GPLv2+
- fedora 43: djvulibre 3.5.28-14.fc43 Β· GPL-2.0-or-later
- fedora 43: djvulibre 3.5.30-1.fc43 Β· GPL-2.0-or-later
- fedora 44: djvulibre 3.5.28-16.fc44 Β· GPL-2.0-or-later
- fedora 44: djvulibre 3.5.30-1.fc44 Β· GPL-2.0-or-later
- opensuse-leap 16.0: djvulibre 3.5.28-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: djvulibre 3.5.28-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: djvulibre 3.5.28-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: djvulibre 3.5.28-160000.2.2 Β· GPL-2.0-or-later
- ubuntu jammy: djvulibre-bin 3.5.28-2build2
- ubuntu jammy: djvulibre-bin 3.5.28-2ubuntu0.22.04.2
- ubuntu noble: djvulibre-bin 3.5.28-2build4
- ubuntu noble: djvulibre-bin 3.5.28-2ubuntu0.24.04.2
- ubuntu questing: djvulibre-bin 3.5.28-2.2
- ubuntu resolute: djvulibre-bin 3.5.29-1
- ubuntu stonking: djvulibre-bin 3.5.30-1
- Copyright (c) 2002 Bill C. Riemers
- Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms