class DjVmDoc: public GPEnabled

Read/Write DjVu multipage documents.

Inheritance:


Public Methods

[more]void insert_file(ByteStream &data, DjVmDir::File::FILE_TYPE file_type, const char *name, const char *id, const char *title=0, int pos=-1)
Inserts a file into the document.
[more]void insert_file(const GP<DjVmDir::File> & f, GP<DataPool> data, int pos=-1)
Inserts a file described by DjVmDir::File structure with data data at position pos.
[more]void delete_file(const char * id)
Removes file with the specified file inside a new DjVu multipage document has its unique ID (refer to DjVmDir for details), which is passed to this function.
[more]GP<DjVmDir> get_djvm_dir(void)
Returns the directory of the DjVm document (the one which will be encoded into DJVM chunk of the top-level file or the bundle).
[more]GP<DataPool> get_data(const char * id)
Returns contents of file with ID Please refer to DjVmDir for the explanation of what IDs mean.
[more] DjVmDoc(void)
Constructor

Public

[more] Reading routines
[more] Writing routines


Inherited from GPEnabled:

Public Methods

oGPEnabled& operator=(const GPEnabled & obj)
oint get_count(void) const

Protected Fields

ovolatile int count


Documentation

Read/Write DjVu multipage documents.

The "new" DjVu multipage documents can be of two types: bundled and indirect. In the first case all pages are packed into one file, which is very like an archive internally. In the second case every page is stored in a separate file. Plus there can be other components, included into one or more pages, which also go into separate files. In addition to pages and components, in the case of the indirect format there is one more top-level file with the document directory (see DjVmDir), which is basically an index file containing the list of all files composing the document.

This class can read documents of both formats and can save them under any format. It is therefore ideal for converting between bundled and indirect formats. It cannot be used however for reading obsolete formats. The best way to convert obsolete formats consists in reading them with class DjVuDocument class and saving them using write or expand.

This class can also be used to create and modify multipage documents at the low level without decoding every page or component (See insert_file() and delete_file()).

ovoid insert_file(ByteStream &data, DjVmDir::File::FILE_TYPE file_type, const char *name, const char *id, const char *title=0, int pos=-1)
Inserts a file into the document.
Parameters:
data - ByteStream containing the file data.
file_type - Describes the type of the file to be inserted. See DjVmDir::File for details.
name - Name of the file in the document (e.g. an URL).
id - Identifier of the file (as used in INCL chunks).
title - Optional title of the file (shown in browsers).
pos - Position of the file in the document (default is append).

ovoid insert_file(const GP<DjVmDir::File> & f, GP<DataPool> data, int pos=-1)
Inserts a file described by DjVmDir::File structure with data data at position pos. If pos is negative, the file will be appended to the document. Otherwise it will be inserted at position pos.

ovoid delete_file(const char * id)
Removes file with the specified file inside a new DjVu multipage document has its unique ID (refer to DjVmDir for details), which is passed to this function.

oGP<DjVmDir> get_djvm_dir(void)
Returns the directory of the DjVm document (the one which will be encoded into DJVM chunk of the top-level file or the bundle).

oGP<DataPool> get_data(const char * id)
Returns contents of file with ID Please refer to DjVmDir for the explanation of what IDs mean.

o Reading routines
Reading routines

ovoid read(ByteStream & str)
Reads contents of a bundled multipage DjVu document from the stream.

ovoid read(const GP<DataPool> & data_pool)
Reads contents of a bundled multipage DjVu document from the DataPool.

ovoid read(const char * name)
Reads the DjVu multipage document in either bundled or indirect format.

Note: For bundled documents the file is not read into memory. We just open it and access data directly there. Thus you should not modify the file contents.

Parameters:
name - For bundled documents this is the name of the document. For indirect documents this is the name of the top-level file of the document (containing the DjVmDir with the list of all files). The rest of the files are expected to be in the same directory and will be read by this function as well.

o Writing routines
Writing routines

ovoid write(ByteStream & str)
Writes the multipage DjVu document in the bundled format into the stream.

ovoid write_index(ByteStream & str)
Stored index (top-level) file of the DjVu document in the indirect format into the specified stream.

ovoid expand(const char * dir_name, const char * idx_name)
Writes the multipage DjVu document in the indirect format into the given directory. Every page and included file will be stored as a separate file. Besides, one top-level file with the document directory (named

Parameters:
dir_name - Name of the directory where files should be created
idx_name - Name of the top-level file with the
DjVmDir with the list of files composing the given document. If empty, the file will not be created.

o DjVmDoc(void)
Constructor


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.