Blame tools/djvused.1

Packit df99a1
.\" Copyright (c) 2001-2003 Leon Bottou, Yann Le Cun, Patrick Haffner,
Packit df99a1
.\" Copyright (c) 2001 AT&T Corp., and Lizardtech, Inc.
Packit df99a1
.\"
Packit df99a1
.\" This is free documentation; you can redistribute it and/or
Packit df99a1
.\" modify it under the terms of the GNU General Public License as
Packit df99a1
.\" published by the Free Software Foundation; either version 2 of
Packit df99a1
.\" the License, or (at your option) any later version.
Packit df99a1
.\"
Packit df99a1
.\" The GNU General Public License's references to "object code"
Packit df99a1
.\" and "executables" are to be interpreted as the output of any
Packit df99a1
.\" document formatting or typesetting system, including
Packit df99a1
.\" intermediate and printed output.
Packit df99a1
.\"
Packit df99a1
.\" This manual is distributed in the hope that it will be useful,
Packit df99a1
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit df99a1
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit df99a1
.\" GNU General Public License for more details.
Packit df99a1
.\"
Packit df99a1
.\" You should have received a copy of the GNU General Public
Packit df99a1
.\" License along with this manual. Otherwise check the web site
Packit df99a1
.\" of the Free Software Foundation at http://www.fsf.org.
Packit df99a1
.TH DJVUSED 1 "5/22/2005" "DjVuLibre-3.5" "DjVuLibre-3.5"
Packit df99a1
.de SS
Packit df99a1
.SH \\0\\0\\0\\$*
Packit df99a1
..
Packit df99a1
.SH NAME
Packit df99a1
djvused \- Multi-purpose DjVu document editor.
Packit df99a1
Packit df99a1
.SH SYNOPSIS
Packit df99a1
.BI "djvused [" "options" "] " "djvufile"
Packit df99a1
Packit df99a1
Packit df99a1
.SH DESCRIPTION
Packit df99a1
Program
Packit df99a1
.B djvused 
Packit df99a1
is a powerful command line tool for manipulating multi-page documents,
Packit df99a1
creating or editing annotation chunks, creating or editing hidden text layers, 
Packit df99a1
pre-computing thumbnail images, and more.  
Packit df99a1
The program first reads the DjVu document
Packit df99a1
.I djvufile
Packit df99a1
and executes a number of djvused commands.
Packit df99a1
Packit df99a1
Djvused commands can be read from a specific file (when option
Packit df99a1
.B -f
Packit df99a1
is specified), read from the command line (when option
Packit df99a1
.B -e
Packit df99a1
is specified), or read from the standard input (the default).
Packit df99a1
Packit df99a1
.SH OPTIONS
Packit df99a1
.TP
Packit df99a1
.BI "-v"
Packit df99a1
Cause 
Packit df99a1
.B djvused 
Packit df99a1
to print a command line prompt before reading commands
Packit df99a1
and a brief message describing how each command was executed.
Packit df99a1
This option is very useful for debugging djvused scripts
Packit df99a1
and also for interactively entering djvused commands on
Packit df99a1
the standard input.
Packit df99a1
.TP
Packit df99a1
.BI "-f " "scriptfile"
Packit df99a1
Cause
Packit df99a1
.B djvused
Packit df99a1
to read commands from file
Packit df99a1
.IR scriptfile .
Packit df99a1
.TP
Packit df99a1
.BI "-e " "command"
Packit df99a1
Cause
Packit df99a1
.B djvused
Packit df99a1
to execute the commands specified by the option argument
Packit df99a1
.IR commands .
Packit df99a1
It is advisable to surround the djvused commands by single
Packit df99a1
quotes in order to prevent unwanted shell expansion.
Packit df99a1
.TP
Packit df99a1
.BI "-s"
Packit df99a1
Cause 
Packit df99a1
.B djvused
Packit df99a1
to save the file 
Packit df99a1
.I djvufile
Packit df99a1
after executing the specified commands.
Packit df99a1
This is similar to executing command
Packit df99a1
.B save
Packit df99a1
immediately before terminating the program.
Packit df99a1
.TP
Packit df99a1
.BI "-u"
Packit df99a1
Cause
Packit df99a1
.B djvused
Packit df99a1
to print hidden text and annotations as UTF-8 
Packit df99a1
instead of encoding non-ASCII characters with octal escape sequences
Packit df99a1
for maximal portability. This option is convenient for 
Packit df99a1
manually editing or viewing the djvused output.
Packit df99a1
This option also causes the emission of an UTF-8 BOM under Windows.
Packit df99a1
.TP
Packit df99a1
.BI "-n"
Packit df99a1
Cause 
Packit df99a1
.B djvused 
Packit df99a1
to disregard save commands.
Packit df99a1
This is useful for debugging djvused scripts
Packit df99a1
without overwriting files on your disk.
Packit df99a1
Packit df99a1
.SH DJVUSED EXAMPLES
Packit df99a1
There are many ways to use program
Packit df99a1
.BR djvused .
Packit df99a1
The following examples illustrate 
Packit df99a1
some common uses of this program.
Packit df99a1
Packit df99a1
.SS Obtaining the size of a page
Packit df99a1
Command 
Packit df99a1
.B size 
Packit df99a1
outputs the width and height of the selected pages
Packit df99a1
using a
Packit df99a1
.SM HTML
Packit df99a1
friendly syntax. 
Packit df99a1
For instance, the following command prints the size 
Packit df99a1
of page
Packit df99a1
.I 3
Packit df99a1
of document
Packit df99a1
.IR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'select 3; size'"
Packit df99a1
.PP
Packit df99a1
Packit df99a1
.SS Extracting the hidden text
Packit df99a1
Command
Packit df99a1
.B print-pure-txt
Packit df99a1
outputs the text associated with a page or a document.
Packit df99a1
For instance, the following shell command outputs the text
Packit df99a1
for the entire document.  Lines and pages are delimited
Packit df99a1
by the usual control characters.
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'print-pure-txt'"
Packit df99a1
.PP
Packit df99a1
Command
Packit df99a1
.B print-txt
Packit df99a1
produces a more extensive output describing the structure
Packit df99a1
and the location of the text components.  The syntax of this
Packit df99a1
output is described later in this man page.  For instance, 
Packit df99a1
the following shell command outputs extended text information
Packit df99a1
for page 
Packit df99a1
.I 3 
Packit df99a1
of document
Packit df99a1
.IR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'select 3; print-txt'"
Packit df99a1
.PP
Packit df99a1
Packit df99a1
.SS Extracting the annotations
Packit df99a1
Annotation data can be extracted using command 
Packit df99a1
.BR print-ant .
Packit df99a1
The syntax of the annotation data is described later in this man page.
Packit df99a1
For instance, the following shell command outputs the annotation data
Packit df99a1
for the first page of document
Packit df99a1
.BR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'select 1; print-ant'"
Packit df99a1
.PP
Packit df99a1
Command 
Packit df99a1
.B print-ant
Packit df99a1
only prints the annotations stored in the selected component file.
Packit df99a1
Command
Packit df99a1
.B print-merged-ant
Packit df99a1
also retrieves annotations from all the component files 
Packit df99a1
referenced by the current page (using 
Packit df99a1
.SM INCL
Packit df99a1
chunks) and prints the merged information.
Packit df99a1
Packit df99a1
.SS Dumping/restoring annotations and text
Packit df99a1
Three commands,
Packit df99a1
.BR "output-txt" ", " "output-ant" ", and " "output-all" ","
Packit df99a1
produce djvused scripts.  For instance, the following shell command
Packit df99a1
produces a djvused script,
Packit df99a1
.IR myfile.dsed ,
Packit df99a1
that recreates all the text and annotation data
Packit df99a1
in document
Packit df99a1
.IR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'output-all' > " "myfile.dsed"
Packit df99a1
.PP
Packit df99a1
Script
Packit df99a1
.I myfile.dsed
Packit df99a1
is a text file that can be easily edited.  The following shell command
Packit df99a1
then recreates the text and annotation information in file
Packit df99a1
.IR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -f " "myfile.dsed" " -s"
Packit df99a1
Packit df99a1
.SS Extracting a page
Packit df99a1
Both commands
Packit df99a1
.B save-page
Packit df99a1
and
Packit df99a1
.B save-page-with
Packit df99a1
create a DjVu file representing the selected component file of a
Packit df99a1
document.  The following shell command, for instance, creates a file
Packit df99a1
.I p05.djvu
Packit df99a1
containing page
Packit df99a1
.I 5
Packit df99a1
of document
Packit df99a1
.IR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'select 5; save-page " "p05.djvu" "'"
Packit df99a1
.PP
Packit df99a1
Each page of a document might import data from 
Packit df99a1
another component file using the so-called inclusion (
Packit df99a1
.SM INCL
Packit df99a1
) chunks.  Command
Packit df99a1
.B save-page
Packit df99a1
then produces a file with unresolved references to imported data.  
Packit df99a1
Such a file should then be made part of a multi-page document
Packit df99a1
containing the required data in other component files.
Packit df99a1
On the other hand, command 
Packit df99a1
.B save-page-with
Packit df99a1
copies all the imported data into the output file.
Packit df99a1
This file is directly usable. Yet collecting several
Packit df99a1
such files into a multi-page document might lead
Packit df99a1
to useless data replication.
Packit df99a1
Packit df99a1
.SS Pre-computing thumbnails
Packit df99a1
Commands 
Packit df99a1
.B set-thumbnails
Packit df99a1
constructs thumbnails that can be later displayed by
Packit df99a1
DjVu viewers.  The following shell command, for instance,
Packit df99a1
computes thumbnails of size 
Packit df99a1
.IR 64 x 64
Packit df99a1
pixels for all pages of file
Packit df99a1
.IR myfile.djvu .
Packit df99a1
.IP "" 3
Packit df99a1
.BI "djvused " "myfile.djvu" " -e 'set-thumbnails 64' -s"
Packit df99a1
Packit df99a1
.SH DJVUSED COMMANDS
Packit df99a1
Command lines might contain zero, one, or more djvused commands and an
Packit df99a1
optional comment.  Multiple djvused commands must be separated by a
Packit df99a1
semicolon character ';'.  Comments are introduced by the '#' character
Packit df99a1
and extend until the end of the command line.
Packit df99a1
Packit df99a1
.SS Selection commands
Packit df99a1
Multi-page DjVu documents are composed of a number of component files.
Packit df99a1
Most component files describe a specific page of a document.  Some
Packit df99a1
component files contain information shared by several pages such as
Packit df99a1
shared image data, shared annotations or thumbnails.  Many djvused
Packit df99a1
commands operate on selected component files.  All component files are
Packit df99a1
initially selected.  The following commands are useful for changing
Packit df99a1
the selection.
Packit df99a1
.TP
Packit df99a1
.BI "n"
Packit df99a1
Print the total number of pages in the document.
Packit df99a1
.TP
Packit df99a1
.BI "ls"
Packit df99a1
List all component files in the document.  Each line contains an
Packit df99a1
optional page number, a letter describing the component file type, the
Packit df99a1
size of the component file, and identifier of the component file.
Packit df99a1
Component file type letters
Packit df99a1
.BR P ", " I ", " A ", and " T 
Packit df99a1
respectively stand for page data, shared image data, shared annotation
Packit df99a1
data, and thumbnail data.  Page numbers are only listed for component
Packit df99a1
files containing page data.  
Packit df99a1
When it is set, the optional page title (see command
Packit df99a1
.B "set-page-title"
Packit df99a1
below) is displayed after the component file identifier.
Packit df99a1
.TP
Packit df99a1
.BI "select [" "fileid" "]"
Packit df99a1
Select the component file identified by argument
Packit df99a1
.IR fileid .
Packit df99a1
Argument 
Packit df99a1
.I fileid
Packit df99a1
must be either a page number or a component file identifier.
Packit df99a1
The
Packit df99a1
.B select
Packit df99a1
command selects all component files
Packit df99a1
when the argument
Packit df99a1
.I fileid
Packit df99a1
is omitted.
Packit df99a1
.TP
Packit df99a1
.BI "select-shared-ant"
Packit df99a1
Select a component file containing shared annotations.  
Packit df99a1
Only one such component file is supported by the current DjVu software. 
Packit df99a1
This component file usually contains annotations pertaining to the 
Packit df99a1
whole document as opposed to specific pages.  An error message 
Packit df99a1
is displayed if there is no such component file.
Packit df99a1
.TP
Packit df99a1
.BI "create-shared-ant"
Packit df99a1
Create and select a component file containing shared annotations.
Packit df99a1
This command only selects the shared annotation component file if such
Packit df99a1
a component file already exists.  Otherwise it creates a new shared
Packit df99a1
annotation component file and makes sure that it is imported by all
Packit df99a1
pages in the document.
Packit df99a1
.TP
Packit df99a1
.BI "showsel"
Packit df99a1
Shows the currently selected component files
Packit df99a1
with the same format as command
Packit df99a1
.BR ls .
Packit df99a1
Packit df99a1
.SS Text and annotation commands
Packit df99a1
.TP
Packit df99a1
.BI "print-pure-txt"
Packit df99a1
Print the text stored in the hidden text layer of the selected pages.
Packit df99a1
A similar capability is offered by program
Packit df99a1
.BR djvutxt .
Packit df99a1
Structural information is sometimes represented by control characters.
Packit df99a1
Text from different pages is delimited by form feed characters
Packit df99a1
("\\f").  Lines are delimited by newline characters ("\\n").  Columns,
Packit df99a1
regions, and paragraphs are sometimes delimited by vertical tab
Packit df99a1
("\\013"), group separators ("\\035") and unit separators ("\\037")
Packit df99a1
respectively.
Packit df99a1
.TP
Packit df99a1
.BI "print-txt"
Packit df99a1
Prints extensive hidden text information for the selected pages.
Packit df99a1
This information describes the structure of the text on the 
Packit df99a1
document page and locates the structural elements in the page image.
Packit df99a1
The syntax of this output is described later in this man page.
Packit df99a1
.TP
Packit df99a1
.BI "remove-txt"
Packit df99a1
Remove the hidden text information from the selected component files.
Packit df99a1
For instance, executing commands
Packit df99a1
.BR "select" " and " "remove-txt"
Packit df99a1
removes all hidden text information from the DjVu document.
Packit df99a1
.TP
Packit df99a1
.BI "set-txt [" "djvusedtxtfile" "]"
Packit df99a1
Insert hidden text information into the selected pages.
Packit df99a1
The optional argument
Packit df99a1
.I djvusedtxtfile
Packit df99a1
names a file containing the hidden text information.
Packit df99a1
This file must contain data similar to what is produced
Packit df99a1
by command
Packit df99a1
.BR print-txt . 
Packit df99a1
When the optional argument is omitted, the
Packit df99a1
program reads the hidden text information from the djvused script
Packit df99a1
until reaching an end-of-file or a line containing a single period.
Packit df99a1
.TP
Packit df99a1
.BI "output-txt"
Packit df99a1
Prints a djvused script that reconstructs the hidden text
Packit df99a1
information for the selected pages.  This script can later
Packit df99a1
be edited and executed by invoking program
Packit df99a1
.B djvused
Packit df99a1
with option
Packit df99a1
.BR -f .
Packit df99a1
.TP
Packit df99a1
.BI "print-ant"
Packit df99a1
Prints the annotations of the selected component file.
Packit df99a1
The annotation data is represented using a simple syntax
Packit df99a1
described later in this document.
Packit df99a1
.TP
Packit df99a1
.BI "print-merged-ant"
Packit df99a1
Merge the annotations stored in the selected component files
Packit df99a1
with the annotations imported from other component files such
Packit df99a1
as the shared annotation component file..
Packit df99a1
The annotation data is represented using a simple syntax
Packit df99a1
described later in this document.
Packit df99a1
.TP
Packit df99a1
.BI "remove-ant"
Packit df99a1
Remove the annotation information from the selected component files.
Packit df99a1
For instance, executing commands
Packit df99a1
.BR "select" " and " "remove-ant"
Packit df99a1
removes all annotation information from the DjVu document.
Packit df99a1
.TP
Packit df99a1
.BI "set-ant [" "djvusedantfile" "]"
Packit df99a1
Insert annotations into the selected component file.
Packit df99a1
The optional argument
Packit df99a1
.I djvusedantfile
Packit df99a1
names a file containing the annotation data.
Packit df99a1
This file must contain data similar to what is produced
Packit df99a1
by command
Packit df99a1
.BR print-ant . 
Packit df99a1
When the optional argument is omitted, the
Packit df99a1
program reads the annotation data from the djvused script itself
Packit df99a1
until reaching an end-of-file or a line containing a single period.
Packit df99a1
.TP
Packit df99a1
.BI "output-ant"
Packit df99a1
Print a djvused script that reconstructs the annotation
Packit df99a1
information for the selected pages.  This script can later
Packit df99a1
be edited and executed by invoking program
Packit df99a1
.B djvused
Packit df99a1
with option
Packit df99a1
.BR -f .
Packit df99a1
.TP
Packit df99a1
.BI "print-meta"
Packit df99a1
Print the metadata part of the annotations for the selected component file.
Packit df99a1
This command displays a subset of the information printed by command
Packit df99a1
.B print-ant
Packit df99a1
using a different syntax.  metadata are organized as key\-value pairs.
Packit df99a1
Each printed line contains the key name such as
Packit df99a1
.BR "author" ", " "title" ",etc.,"
Packit df99a1
followed by a tab character ("\\t") and
Packit df99a1
a double-quoted string representing the 
Packit df99a1
.SM UTF-8
Packit df99a1
encoded metadata value.
Packit df99a1
.TP
Packit df99a1
.BI "remove-meta"
Packit df99a1
Remove the metadata part of the annotations of 
Packit df99a1
the selected component files.
Packit df99a1
.TP
Packit df99a1
.BI "set-meta [" "djvusedmetafile" "]"
Packit df99a1
Set the metadata part of the annotations of the selected component file.
Packit df99a1
The remaining part of the annotations is left unchanged.
Packit df99a1
The optional argument
Packit df99a1
.I djvusedmetafile
Packit df99a1
names a file containing the metadata.
Packit df99a1
This file must contain data similar to what is produced
Packit df99a1
by command
Packit df99a1
.BR print-meta . 
Packit df99a1
When the optional argument is omitted, the
Packit df99a1
program reads the annotation data from the djvused script itself
Packit df99a1
until reaching an end-of-file or a line containing a single period.
Packit df99a1
.TP
Packit df99a1
.BI "print-xmp"
Packit df99a1
Print the XMP metadata string contained in 
Packit df99a1
the annotation chunk of the selected component file.
Packit df99a1
This command displays in fact a subset of the 
Packit df99a1
information printed by command
Packit df99a1
.BR print-ant .
Packit df99a1
.TP
Packit df99a1
.BI "remove-xmp"
Packit df99a1
Removes the XMP tag from the annotation chunk of the selected component file.
Packit df99a1
.TP
Packit df99a1
.BI "set-xmp [" "xmpfile" "]"
Packit df99a1
Set the XMP metadata part of the annotations of the selected component file.
Packit df99a1
The remaining part of the annotations is left unchanged.
Packit df99a1
The optional argument
Packit df99a1
.I xmpfile
Packit df99a1
names a file containing the XMP metadata in a format 
Packit df99a1
similar to that produced
Packit df99a1
by command
Packit df99a1
.BR print-xmp . 
Packit df99a1
When the optional argument is omitted, the
Packit df99a1
program reads the XMP annotation data from the djvused script itself
Packit df99a1
until reaching an end-of-file or a line containing a single period.
Packit df99a1
.TP
Packit df99a1
.BI "output-all"
Packit df99a1
Print a djvused script that reconstructs both the hidden text and the
Packit df99a1
annotation information for the selected pages.  This script can later
Packit df99a1
be edited and executed by invoking program
Packit df99a1
.B djvused
Packit df99a1
with option
Packit df99a1
.BR -f .
Packit df99a1
.PP
Packit df99a1
.SS Outline/bookmarks commands
Packit df99a1
.TP
Packit df99a1
.BI "print-outline"
Packit df99a1
Print the outline of the document.
Packit df99a1
Nothing is printed if the document contains no outline.
Packit df99a1
.TP
Packit df99a1
.BI "remove-outline"
Packit df99a1
Removes the outline from the document.
Packit df99a1
.TP
Packit df99a1
.BI "set-outline [" djvusedoutlinefile "]"
Packit df99a1
Insert outline information into the document.
Packit df99a1
The optional argument
Packit df99a1
.I djvusedoutlinefile
Packit df99a1
names a file containing the outline information.
Packit df99a1
This file must contain data similar to what is produced
Packit df99a1
by command
Packit df99a1
.BR print-outline . 
Packit df99a1
When the optional argument is omitted, the
Packit df99a1
program reads the hidden text information from the djvused script
Packit df99a1
until reaching an end-of-file or a line containing a single period.
Packit df99a1
.PP
Packit df99a1
.SS Thumbnail commands
Packit df99a1
.TP
Packit df99a1
.BI "set-thumbnails " "sz"
Packit df99a1
Compute thumbnails of size
Packit df99a1
.IR sz x sz
Packit df99a1
pixels and insert them into the document.
Packit df99a1
DjVu viewers can later display these thumbnails very
Packit df99a1
efficiently without need to download the data for
Packit df99a1
each page.  Typical thumbnail size range 
Packit df99a1
from 48 to 128 pixels.
Packit df99a1
.TP
Packit df99a1
.BI "remove-thumbnails"
Packit df99a1
Remove the pre-computed thumbnails from the DjVu document.
Packit df99a1
New thumbnails can then be computed using command
Packit df99a1
.BR set-thumbnails .
Packit df99a1
Packit df99a1
.SS Save commands
Packit df99a1
The above commands only modify the memory image of the DjVu document.
Packit df99a1
The following commands provide means to save the modified data
Packit df99a1
into the file system.
Packit df99a1
.TP
Packit df99a1
.BI "save"
Packit df99a1
Save the modified DjVu document back into the input file
Packit df99a1
.I djvufile
Packit df99a1
specified by the arguments of the program 
Packit df99a1
.BR djvused .
Packit df99a1
Nothing is done if the DjVu file was not modified.
Packit df99a1
Passing option
Packit df99a1
.B -s
Packit df99a1
program
Packit df99a1
.B djvused 
Packit df99a1
is equivalent to executing command
Packit df99a1
.B save
Packit df99a1
before exiting the program.
Packit df99a1
.TP
Packit df99a1
.BI "save-bundled " "filename"
Packit df99a1
Save the current DjVu document as a bundled 
Packit df99a1
multi-page DjVu document named 
Packit df99a1
.IR filename .
Packit df99a1
A similar capability is offered by program
Packit df99a1
.BR djvmcvt .
Packit df99a1
.TP
Packit df99a1
.BI "save-indirect " "filename"
Packit df99a1
Save the current DjVu document as an indirect
Packit df99a1
multi-page DjVu document.  The index file of the
Packit df99a1
indirect document will be named 
Packit df99a1
.BR filename .
Packit df99a1
All other files composing the indirect document
Packit df99a1
will be saved into the same directory as the
Packit df99a1
index file.
Packit df99a1
A similar capability is offered by program
Packit df99a1
.BR djvmcvt .
Packit df99a1
.TP
Packit df99a1
.BI "save-page " "filename"
Packit df99a1
Save the selected component file into DjVu file
Packit df99a1
.IR filename .
Packit df99a1
The selected component file might import data from 
Packit df99a1
another component file using the so-called inclusion (
Packit df99a1
.SM INCL
Packit df99a1
) chunks.  This command then produces a file with unresolved
Packit df99a1
references to imported data.  Such a file should then be made part of
Packit df99a1
a multi-page document containing the required data in other component
Packit df99a1
files.
Packit df99a1
.TP
Packit df99a1
.BI "save-page-with " "filename"
Packit df99a1
Save the selected component file into DjVu file
Packit df99a1
.IR filename .
Packit df99a1
All data imported from other component files is copied into the output
Packit df99a1
file as well.  This command always produces a usable DjVu file.  On
Packit df99a1
the other hand, collecting several such files into a multi-page
Packit df99a1
document might lead to useless data replication.
Packit df99a1
Packit df99a1
.SS Miscellaneous commands
Packit df99a1
.TP
Packit df99a1
.BI "help"
Packit df99a1
Display a help message listing all commands supported by
Packit df99a1
.BR djvused .
Packit df99a1
.TP
Packit df99a1
.BI "dump"
Packit df99a1
Display the 
Packit df99a1
.SM EA IFF 85
Packit df99a1
structure of the document or of the selected component file.
Packit df99a1
A similar capability is offered by program
Packit df99a1
.BR djvudump .
Packit df99a1
.TP
Packit df99a1
.BI "size"
Packit df99a1
Display the width and the height of the selected pages.  The
Packit df99a1
dimensions of each page are displayed using a syntax suitable for
Packit df99a1
direct insertion into the
Packit df99a1
.SM <EMBED...></EMBED>
Packit df99a1
tags. This command also displays the default page orientation
Packit df99a1
when it is different from zero.
Packit df99a1
.TP
Packit df99a1
.BI "set-rotation [+-]" "rot"
Packit df99a1
Changes the default orientation of the selected pages.
Packit df99a1
The orientation is expressed as an integer in range 0..3
Packit df99a1
representing a number of 90 degree counter-clockwise rotations.
Packit df99a1
When the argument is preceded by a sign
Packit df99a1
.BR "+" " or " "-" ","
Packit df99a1
argument
Packit df99a1
.I rot
Packit df99a1
counts how many additional 90 degree counter-clockwise rotations
Packit df99a1
should be applied to the page. Otherwise, argument
Packit df99a1
.I rot
Packit df99a1
represents the desired absolute page orientation.
Packit df99a1
Only DjVu pages can be rotated.
Packit df99a1
Pages represented as a raw IW44 image cannot be rotated.
Packit df99a1
.TP
Packit df99a1
.BI "set-dpi " "dpi"
Packit df99a1
Sets the resolution of the page image in dots per inche.
Packit df99a1
Argument
Packit df99a1
.I dpi
Packit df99a1
should be in range 25..6000.
Packit df99a1
.TP
Packit df99a1
.BI "set-page-title " "title"
Packit df99a1
Sets a page title for the selected page.
Packit df99a1
When page titles are available, recent versions 
Packit df99a1
of the DjVuLibre viewers display these page
Packit df99a1
titles instead of page numbers and also 
Packit df99a1
accept them in page selection options.
Packit df99a1
Command
Packit df99a1
.B "ls"
Packit df99a1
can be used to see both the page titles and page identifiers.
Packit df99a1
To unset a page title, simply make it equal to the page identifier.
Packit df99a1
Packit df99a1
.SH DJVUSED FILE FORMATS
Packit df99a1
Packit df99a1
Djvused uses a simple parenthesized syntax to represent
Packit df99a1
both annotations and hidden text.
Packit df99a1
.IP "*" 3
Packit df99a1
This syntax is the native syntax used by DjVu for storing annotations.
Packit df99a1
Program
Packit df99a1
.B djvused
Packit df99a1
simply compresses the annotation data using the
Packit df99a1
.BR bzz (1)
Packit df99a1
algorithm.
Packit df99a1
.IP "*" 3
Packit df99a1
This syntax differs from the native syntax used by DjVu for
Packit df99a1
storing the hidden text.  Program 
Packit df99a1
.B djvused
Packit df99a1
performs the translations between the compact binary representation
Packit df99a1
used by DjVu and the easily modifiable parenthesized syntax.
Packit df99a1
.PP
Packit df99a1
Packit df99a1
.SS General syntax
Packit df99a1
Djvused files are
Packit df99a1
.SM ASCII
Packit df99a1
text files.  The legal characters in djvused files are 
Packit df99a1
the printable 
Packit df99a1
.SM ASCII 
Packit df99a1
characters and the space, tab, cr, and nl characters.
Packit df99a1
Using other characters has undefined results.
Packit df99a1
Packit df99a1
Djvused files are composed of a sequence of expressions separated by
Packit df99a1
blank characters (space, tab, cr, or nl).  There are four kind of
Packit df99a1
expressions, namely integers, symbols, strings and lists.
Packit df99a1
.IP Integers:
Packit df99a1
Integer numbers are represented by one or more digits,
Packit df99a1
with the usual interpretation.
Packit df99a1
.IP Symbols:
Packit df99a1
Symbols, or identifiers, are sequences of printable ascii characters
Packit df99a1
representing a name or a keyword.  Acceptable characters are the alpha-numeric
Packit df99a1
characters, the underscore "_", the minus character "-", and the hash
Packit df99a1
character "#".  Names should not begin with a digit or a minus character.
Packit df99a1
.IP Strings:
Packit df99a1
Strings denote an arbitrary sequence of bytes,
Packit df99a1
usually interpreted as a sequence of 
Packit df99a1
.SM UTF-8
Packit df99a1
encoded characters.  Strings in djvused files are similar to strings in the C
Packit df99a1
language.  They are surrounded by double quote characters.  Certain sequences
Packit df99a1
of characters starting with a backslash ("\\") have a special meaning.  
Packit df99a1
A backslash followed by letter
Packit df99a1
"a", "b", "t", "n", "v", "f", "r", "\\", and \"
Packit df99a1
stands for the ascii character BEL(007), BS(008), HT(009),
Packit df99a1
LF(010), VT(011), FF(012), CR(013), BACKSLASH(134) 
Packit df99a1
and DOUBLEQUOTE(042) respectively.
Packit df99a1
A backslash followed by one to three digits stands for the byte 
Packit df99a1
whose octal code is expressed by the digits.  
Packit df99a1
All other backslash sequences are illegal.
Packit df99a1
All non printable ascii characters must be escaped.
Packit df99a1
.IP Lists:
Packit df99a1
Lists are sequence of expressions separated by blanks and surrounded by
Packit df99a1
parentheses.  All expressions types are acceptable within a list, including
Packit df99a1
sub-lists.
Packit df99a1
Packit df99a1
.SS Hidden text syntax
Packit df99a1
The building blocks of the hidden text syntax are lists
Packit df99a1
representing each structural component of the hidden text.
Packit df99a1
Structural components have the following form:
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(" "type" " " "xmin" " " "ymin" " " "xmax" " " "ymax" " ... )"
Packit df99a1
.PP
Packit df99a1
Packit df99a1
The symbol
Packit df99a1
.I type
Packit df99a1
must be one of 
Packit df99a1
.BR page ", " column ", " region ", " para ", " line ", " word ", or " char ,
Packit df99a1
listed here by decreasing order of importance.  
Packit df99a1
The integers
Packit df99a1
.IR xmin ", " ymin ", " xmax ", and " ymax
Packit df99a1
represent the coordinates of a rectangle indicating the position of the
Packit df99a1
structural component in the page.  Coordinates are measured in pixels and have
Packit df99a1
their origin at the bottom left corner of the page.  The remaining expressions
Packit df99a1
in the list either is a single string representing the encoded text associated
Packit df99a1
with this structural component, or is a sequence of structural components with
Packit df99a1
a lesser type.
Packit df99a1
.PP
Packit df99a1
The hidden text for each page is simply represented by
Packit df99a1
a single structural element of type
Packit df99a1
.BR page .
Packit df99a1
Various level of structural information are acceptable.  For instance, the
Packit df99a1
page level component might only specify a page level string, or might only
Packit df99a1
provide a list of lines, or might provide a full hierarchy down to the
Packit df99a1
individual characters.
Packit df99a1
Packit df99a1
.SS Outline/Bookmark syntax
Packit df99a1
The outline syntax is a single list of the form
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(bookmarks ...)"
Packit df99a1
.PP
Packit df99a1
The first element of the list is symbol
Packit df99a1
.BR bookmarks .
Packit df99a1
The subsequent elements are lists representing
Packit df99a1
the toplevel outline entries.
Packit df99a1
Each outline entry is represented by
Packit df99a1
a list with the following form:
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(" title " " url " ... )"
Packit df99a1
.PP
Packit df99a1
The string 
Packit df99a1
.I title
Packit df99a1
is the title of the outline entry.
Packit df99a1
The destination string
Packit df99a1
.I url
Packit df99a1
can be either an arbitrary percent encoded
Packit df99a1
.SM URL,
Packit df99a1
or composed of the hash character ("#")
Packit df99a1
followed by a page name or number,
Packit df99a1
or composed of the question mark character ("?")
Packit df99a1
followed by cgi-style arguments interpreted by the djvu viewer.
Packit df99a1
The remaining expressions in the list
Packit df99a1
describe subentries of this outline entry.
Packit df99a1
Packit df99a1
.SS Annotation syntax
Packit df99a1
Annotations are represented by a sequence of annotation expressions.
Packit df99a1
The following annotation expressions are recognized:
Packit df99a1
.TP
Packit df99a1
.BI "(background " color ")"
Packit df99a1
Specify the color of the viewer area surrounding the DjVu image.
Packit df99a1
Colors are represented with the X11 hexadecimal syntax
Packit df99a1
.BR #RRGGBB .
Packit df99a1
For instance, 
Packit df99a1
.B #000000
Packit df99a1
is black and
Packit df99a1
.B #FFFFFF
Packit df99a1
is white.
Packit df99a1
.TP
Packit df99a1
.BI "(zoom " zoomvalue ")"
Packit df99a1
Specify the initial zoom factor of the image.
Packit df99a1
Argument
Packit df99a1
.I zoomvalue
Packit df99a1
can be one of
Packit df99a1
.BR stretch ", " one2one ", " width ", " page ", "
Packit df99a1
or composed of the letter
Packit df99a1
.B d
Packit df99a1
followed by a number in range 1 to 999 representing a zoom factor
Packit df99a1
(such as in
Packit df99a1
.BR d300 " or " d150
Packit df99a1
for instance.)
Packit df99a1
.TP
Packit df99a1
.BI "(mode " modevalue ")"
Packit df99a1
Specify the initial display mode of the image.
Packit df99a1
Argument
Packit df99a1
.I modevalue
Packit df99a1
is one of
Packit df99a1
.BR color ", " bw ", " fore ", or " back "."
Packit df99a1
.TP
Packit df99a1
.BI "(align " horzalign " " vertalign ")"
Packit df99a1
Specify how the image should be aligned on the viewer surface.
Packit df99a1
By default the image is located in the center.  
Packit df99a1
Argument 
Packit df99a1
.I horzalign
Packit df99a1
can be one of
Packit df99a1
.BR left ", " center ", or " right "."
Packit df99a1
Argument 
Packit df99a1
.I vertalign
Packit df99a1
can be one of
Packit df99a1
.BR top ", " center ", or " bottom "."
Packit df99a1
.TP
Packit df99a1
.BI "(maparea " url " " comment " " area " ...)"
Packit df99a1
Define an hyper-link for the specified destination.
Packit df99a1
.RS
Packit df99a1
.PP
Packit df99a1
Argument
Packit df99a1
.I url
Packit df99a1
can have one of the following forms:
Packit df99a1
.IP "" 3
Packit df99a1
.I href
Packit df99a1
.br
Packit df99a1
.BI "(url " href " " target ")" 
Packit df99a1
.br
Packit df99a1
.PP
Packit df99a1
where 
Packit df99a1
.I href
Packit df99a1
is a string representing the destination and 
Packit df99a1
.I target 
Packit df99a1
is a string representing the target frame for the hyper-link,
Packit df99a1
as defined by the 
Packit df99a1
.SM HTML
Packit df99a1
anchor tag
Packit df99a1
.SM .
Packit df99a1
The destination string
Packit df99a1
.I href
Packit df99a1
can be either an arbitrary percent encoded
Packit df99a1
.SM URL,
Packit df99a1
or composed of the hash character ("#")
Packit df99a1
followed by a page name or number,
Packit df99a1
or composed of the question mark character ("?")
Packit df99a1
followed by cgi-style arguments interpreted by the djvu viewer.
Packit df99a1
Page numbers may be prefixed with an optional sign 
Packit df99a1
to represent a page displacement.  
Packit df99a1
For instance the strings
Packit df99a1
.B """#-1""" 
Packit df99a1
and 
Packit df99a1
.B """#+1"""
Packit df99a1
can be used to access the previous page and 
Packit df99a1
the next page.
Packit df99a1
Packit df99a1
Argument 
Packit df99a1
.I comment 
Packit df99a1
is a string that might be displayed by the viewer 
Packit df99a1
when the user moves the mouse over the hyper-link.
Packit df99a1
Packit df99a1
Argument
Packit df99a1
.I area
Packit df99a1
defines the shape and the location of the hyperlink.
Packit df99a1
The following forms are recognized:
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(rect " xmin " " ymin " " width " " height ")"
Packit df99a1
.br
Packit df99a1
.BI "(oval " xmin " " ymin " " width " " height ")"
Packit df99a1
.br
Packit df99a1
.BI "(poly " x0 " " y0 " " x1 " " y1 " ... )"
Packit df99a1
.br
Packit df99a1
.BI "(text " xmin " " ymin " " width " " height ")"
Packit df99a1
.br
Packit df99a1
.BI "(line " x0 " " y0 " " x1 " " y1 ")"
Packit df99a1
.PP
Packit df99a1
All parameters are numbers representing coordinates.  
Packit df99a1
Coordinates are measured in pixels and have their origin 
Packit df99a1
at the bottom left corner of the page.
Packit df99a1
Packit df99a1
The remaining expressions in the
Packit df99a1
.B maparea
Packit df99a1
list represent the visual effect associated with
Packit df99a1
the hyper-link. 
Packit df99a1
Packit df99a1
A first set of options defines how borders
Packit df99a1
are drawn for 
Packit df99a1
.BR rect ", " oval ", " polygon ", or " text 
Packit df99a1
hyperlink areas.
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(none)"
Packit df99a1
.br
Packit df99a1
.BI "(xor)"
Packit df99a1
.br
Packit df99a1
.BI "(border " color ")"
Packit df99a1
.br
Packit df99a1
.BI "(shadow_in [" thickness "])"
Packit df99a1
.br
Packit df99a1
.BI "(shadow_out [" thickness "])"
Packit df99a1
.br
Packit df99a1
.BI "(shadow_ein [" thickness "])"
Packit df99a1
.br
Packit df99a1
.BI "(shadow_eout [" thickness "])"
Packit df99a1
.PP
Packit df99a1
where parameter 
Packit df99a1
.I color
Packit df99a1
has syntax
Packit df99a1
.B #RRGGBB
Packit df99a1
as described above,
Packit df99a1
and parameter thickness is an integer in range 1 to 32.
Packit df99a1
The last four border options are only supported for 
Packit df99a1
.B rect
Packit df99a1
hyperlink areas. 
Packit df99a1
Although the border mode defaults to   
Packit df99a1
.BR (xor) ,
Packit df99a1
it is wise to always specify the border mode.
Packit df99a1
Border options do not apply to 
Packit df99a1
.B line 
Packit df99a1
areas.
Packit df99a1
Packit df99a1
When a border option is specified, the border 
Packit df99a1
becomes visible when the user moves the mouse 
Packit df99a1
over the hyperlink. The border may be made
Packit df99a1
always visible by using the following option:
Packit df99a1
.IP "" 3
Packit df99a1
.B (border_avis)
Packit df99a1
.PP
Packit df99a1
The following two options may be used with 
Packit df99a1
.B rect
Packit df99a1
hyperlink areas.
Packit df99a1
The complete area will be highlighted using the 
Packit df99a1
specified color at the specified opacity (0-100, default 50).
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(hilite " color ")"
Packit df99a1
.br
Packit df99a1
.BI "(opacity " op ")"
Packit df99a1
.PP
Packit df99a1
This is often used with an empty 
Packit df99a1
.SM URL 
Packit df99a1
for simply emphasizing a specific
Packit df99a1
segment of an image.
Packit df99a1
.PP
Packit df99a1
The following three options may be used with line areas to 
Packit df99a1
specify an optional ending arrow, the line width and color.
Packit df99a1
The default is a black line with width 1 and without arrow.
Packit df99a1
.IP "" 3
Packit df99a1
.B "(arrow)"
Packit df99a1
.br
Packit df99a1
.BI "(width " w ")"
Packit df99a1
.br
Packit df99a1
.BI "(lineclr " color ")"
Packit df99a1
.PP
Packit df99a1
Finally the following three options can be used with text areas.
Packit df99a1
The default background color is transparent. 
Packit df99a1
The default text color is black.
Packit df99a1
The 
Packit df99a1
.B pushpin
Packit df99a1
option indicates that the text is symbolized by a small pushpin icon.
Packit df99a1
Clicking the icon reveals the text.
Packit df99a1
.IP "" 3
Packit df99a1
.BI "(backclr " bkcolor ")"
Packit df99a1
.br
Packit df99a1
.BI "(textclr " txtcolor ")"
Packit df99a1
.br
Packit df99a1
.BI "(pushpin)"
Packit df99a1
.PP
Packit df99a1
Packit df99a1
.RE
Packit df99a1
.TP
Packit df99a1
.BI "(metadata ... (" key " " value ") ... )"
Packit df99a1
Define metadata entries.
Packit df99a1
Each entry is identified by a symbol
Packit df99a1
.I key
Packit df99a1
representing the nature of the meta data entry.
Packit df99a1
The string
Packit df99a1
.I value
Packit df99a1
represents
Packit df99a1
the value associated with the corresponding key.
Packit df99a1
Two sets of keys are noteworthy:
Packit df99a1
keys borrowed from the BibTex bibliography system,
Packit df99a1
and keys borrowed from the PDF DocInfo metadata.
Packit df99a1
BibTex keys are always expressed in lowercase, such as
Packit df99a1
.BR year ", " booktitle ", " editor ", " author ", etc.."
Packit df99a1
DocInfo keys start with an uppercase letter, such as
Packit df99a1
.BR Title ", " Author ", " Subject ", " Creator ", "
Packit df99a1
.BR Produced ", " Trapped ", "
Packit df99a1
.BR CreationDate ", and " ModDate "."
Packit df99a1
The values associated with the last two keys
Packit df99a1
should be dates expressed according to RFC 3339.
Packit df99a1
Packit df99a1
.SH LIMITATIONS
Packit df99a1
The current version of program 
Packit df99a1
.B djvused
Packit df99a1
only supports selecting one component file
Packit df99a1
or all component files.  There is no way to
Packit df99a1
select only a few component files.
Packit df99a1
Packit df99a1
.SH CREDITS
Packit df99a1
This program was initially written by L\('eon Bottou
Packit df99a1
<leonb@users.sourceforge.net> and was improved by Yann Le Cun
Packit df99a1
<profshadoko@users.sourceforge.net>, Florin Nicsa, Bill Riemers
Packit df99a1
<docbill@sourceforge.net> and many others.
Packit df99a1
Packit df99a1
.SH SEE ALSO
Packit df99a1
.BR djvu (1),
Packit df99a1
.BR djvutxt (1),
Packit df99a1
.BR djvmcvt (1),
Packit df99a1
.BR djvudump (1),
Packit df99a1
.BR bzz (1),
Packit df99a1
Emacs djvused front end \fBdjvu.el\fR on
Packit df99a1
.SM GNU Elpa
Packit df99a1
repository.