scantools
1.0.4
Graphics manipulation with a view towards scanned documents
|
Reads, writes and renders JBIG2 files, and chops them into pieces for inclusion into a PDF document. More...
#include <JBIG2Document.h>
Public Member Functions | |
JBIG2Document () | |
Creates an empty JBIG2 document. | |
JBIG2Document (QIODevice *device) | |
Constructs a JBIG2 document from a QIODevice. More... | |
JBIG2Document (QString fileName) | |
Constructs a JBIG2 document from a file. More... | |
void | clear () |
Resets the document. More... | |
void | read (QIODevice *device) |
Reads a JBIG2 document from a QIODevice. More... | |
void | read (const QString &fileName) |
Reads a JBIG2 document from a file. More... | |
bool | isEmpty () const |
Checks if the document is empty. More... | |
bool | hasError () const |
Error status. More... | |
QString | error () const |
Error message. More... | |
bool | hasWarnings () const |
Warning status. More... | |
QSet< QString > | warnings () const |
Warning messages. More... | |
QList< quint32 > | pageNumbers () const |
Page numbers used by this document. More... | |
QString | info () const |
Human-readable info string about the document. More... | |
QByteArray | getPDFDataChunk (quint32 pageNumber) const |
Return data ready for inclusion into a PDF file. More... | |
imageInfo | pageInfo (quint32 pageNumber) const |
Compute imageInfo describing a given page. More... | |
QImage | operator[] (quint32 pageNumber) const |
Render image. More... | |
Reads, writes and renders JBIG2 files, and chops them into pieces for inclusion into a PDF document.
This class reads, interprets and renders JBIG2 image files. There exists minimal support for file validation, inspection and manipulation. The main use of this class is to chop JBIG2 files into pieces which can then be included into a PDF file.
The methods of this class are reentrant, but not thread safe.
Definition at line 39 of file JBIG2Document.h.
|
inlineexplicit |
Constructs a JBIG2 document from a QIODevice.
This is a convenience constructor that constructs an empty document and calls read(device).
device | Pointer to a QIODevice from which the file is read |
Definition at line 52 of file JBIG2Document.h.
|
inlineexplicit |
Constructs a JBIG2 document from a file.
This is a convenience constructor that constructs an empty document, opens a file and calls read(QIODevice *device).
fileName | Name of the JBIG2 file |
Definition at line 61 of file JBIG2Document.h.
void JBIG2Document::clear | ( | ) |
Resets the document.
This method clears all errors, warnings, and any file content.
|
inline |
Error message.
Definition at line 122 of file JBIG2Document.h.
QByteArray JBIG2Document::getPDFDataChunk | ( | quint32 | pageNumber | ) | const |
Return data ready for inclusion into a PDF file.
This method returns a concatenation of all JBIG2 segments pertaining to a given page. Following the PDF specification, all end-of-page segements are removed, and all page associations other than '0' are set to '1'. This method must not be called when an error condition exists. Use hasError() or error() to check the error status first.
pageNumber | If zero, the method returns the global data, which is used by all pages of the document. If larger than zero, the method returns the data for the given page. |
|
inline |
Error status.
Definition at line 115 of file JBIG2Document.h.
|
inline |
Warning status.
Definition at line 131 of file JBIG2Document.h.
QString JBIG2Document::info | ( | ) | const |
Human-readable info string about the document.
This method is mainly useful for debugging purposes.
|
inline |
Checks if the document is empty.
Definition at line 99 of file JBIG2Document.h.
QImage JBIG2Document::operator[] | ( | quint32 | pageNumber | ) | const |
Render image.
pageNumber | Number of the page that rendered |
imageInfo JBIG2Document::pageInfo | ( | quint32 | pageNumber | ) | const |
Compute imageInfo describing a given page.
pageNumber | Number of the page that will be described |
QList<quint32> JBIG2Document::pageNumbers | ( | ) | const |
Page numbers used by this document.
void JBIG2Document::read | ( | const QString & | fileName | ) |
Reads a JBIG2 document from a file.
This is a convenience method that opens a file and calls read(QIODevice device).
fileName | Name of the JBIG2 file |
void JBIG2Document::read | ( | QIODevice * | device | ) |
Reads a JBIG2 document from a QIODevice.
This method clears the document, and reads a JBIG2 file from a QIODevice. After method returns, the caller shoud check if an error occurred, by using the methods hasError() and/or error(). The caller might also wish to check if the file contained fixable errors, by calling the method warnings().
The absense of an error or of warnings does not imply that the JBIG2 file is valid. In fact, only minimal checks are made.
device | QIODevice from which the file should be read |
|
inline |
Warning messages.
Definition at line 137 of file JBIG2Document.h.