scantools
1.0.7
Graphics manipulation with a view towards scanned documents
|
24 #include <QReadWriteLock>
27 #include "HOCRDocument.h"
28 #include "JBIG2Document.h"
29 #include "paperSize.h"
30 #include "resolution.h"
170 explicit PDFAWriter(
bool bestCompression=
false, QObject* parent=
nullptr);
398 QString
addPages(
const QImage &image, QStringList *warnings=0);
489 QString
addPages(
const QString &imageFileName, QStringList *warnings=0);
502 operator QByteArray();
571 QString _author, _keywords, _subject, _title;
578 QStringList OCRLanguages;
593 QString addJBIG2(
const QString &fileName, QStringList *warnings=0);
603 QString addJPEG(
const QString &fileName);
614 QString addJPX(
const QString &fileName);
620 QString addTIFF(
const QString &fileName);
626 void addGFXPage(quint32 graphicObjectIndex,
const imageInfo& bInfo,
const QImage& imageForOCR = QImage());
635 protoObject(QByteArray _data) : data(_data) {
640 protoObject(QFuture<QByteArray> _future) : future(_future) {
644 inline operator QByteArray() {
645 if (!future.isCanceled()) {
646 data = future.result();
647 future = QFuture<QByteArray>();
654 QFuture<QByteArray> future;
658 QList<protoObject> objects;
661 quint32 catalogObjectIndex;
662 quint32 metaDataObjectIndex;
663 quint32 infoObjectIndex;
664 quint32 pageDirectoryObjectIndex;
665 quint32 colorProfileObjectIndex;
666 quint32 fontObjectIndex;
669 bool bestCompression;
672 QList<quint32> pageIndices;
675 static QByteArray readFile(
const QString& fileName);
678 QByteArray generatePageDirectoryObject()
const;
682 static QByteArray generateStreamObject(
const QByteArray &input);
685 quint32 getFontObjectIndex();
690 static QByteArray createImageObject_bw_G4(
const QImage &image);
695 static QByteArray createImageObject_bitonal_G4(
const QImage &image);
700 static QByteArray createImageObject_gray_zlib(
const QImage &image,
bool bestCompression);
705 static QByteArray createImageObject_indexed_zlib(
const QImage &image,
bool bestCompression);
710 static QByteArray createImageObject_rgb_zlib(
const QImage &image,
bool bestCompression);
719 static QByteArray completePageContentObject_b(QByteArray contentStream,
const imageInfo& bInfo,
length deltaX,
length deltaY,
const QImage& image,
const QStringList& OCRLanguages);
void setResolutionOverrideVertical(resolution vertical)
Set vertical resolution.
void subjectChanged()
Emitted when subject changes.
QString addPages(const QString &imageFileName, QStringList *warnings=0)
Add images to the PDF document.
Trivial class to store elementary info about bitmap graphics.
QString keywords()
Metadata: Keywords.
Simple generator for PDF/A-2b compliant documents.
QStringList autoOCRLanguages()
List of languages used for OCR.
format
List of supported standard sizes.
The length stores a length and converts between units.
void setPageSize(paperSize::format size=paperSize::empty)
Sets page size, effective for future calls of the methods addPage()
void pageSizeChanged()
Emitted when pageSize changes.
QString setAutoOCRLanguages(const QStringList &nOCRLanguages)
Specify languages used by the tesseract OCR engine.
QString title()
Metadata: Title String.
PDFAWriter(bool bestCompression=false, QObject *parent=nullptr)
Constructor.
QString addPages(const QImage &image, QStringList *warnings=0)
Add an image to the PDF document.
HOCRDocument OCRData()
Return a copy of the internal HOCRDocument.
QString addPages(const JBIG2Document &jbig2doc, QStringList *warnings=0)
Add JBIG2 images to the PDF document.
QString subject()
Metadata: Subject string.
resolution resolutionOverrideVertical()
Vertical resolution.
void setAuthor(const QString &author)
Set the author string in the PDF/A meta data.
void setAutoOCR(bool autoOCR)
Specify if the tesseract OCR engine should be run automatically.
void finished()
Emitted just before waitForWorkerThreads() returns.
void autoOCRChanged()
Emitted when autoOCR changes.
void appendToOCRData(const HOCRDocument &doc)
Specify pre-processed OCR data.
Text box, as defined in an HOCR file.
void resolutionOverrideHorizontalChanged()
Emitted when resolutionOverrideHorizontal changes.
void setPageSize(const paperSize size)
Sets page size, effective for future calls of the methods addPage()
void keywordsChanged()
Emitted when keywords change.
The paperSize class identifies and stores paper sizes.
void setResolutionOverride(resolution horizontal, resolution vertical)
Sets graphic resolution for future calls of the methods addPage()
void progress(qreal percentage)
Progress indicator.
The resolution class stores a resolution and converts between units.
void setSubject(const QString &subject)
Set the subject string in the PDF/A meta data.
void setResolutionOverride(resolution res)
Overloaded method that sets horizontal and vertical resolution to the same value.
void autoOCRLanguagesChanged()
Emitted when autoOCRLanguages change.
void resolutionOverrideVerticalChanged()
Emitted when resolutionOverrideVertical changes.
void titleChanged()
Emitted when title changes.
void setKeywords(const QString &keywords)
Set the author string in the PDF/A meta data.
Reads, writes and renders JBIG2 files, and chops them into pieces for inclusion into a PDF document.
void authorChanged()
Emitted when author changes.
QString author()
Metadata: Author.
void setResolutionOverrideHorizontal(resolution horizontal)
Set horizontal resolution.
Reads and interprets HOCR files, the standard output file format for Optical Character Recognition sy...
void waitForWorkerThreads()
Waits for all worker threads to finish.
resolution resolutionOverrideHorizontal()
Horizontal resolution.
paperSize pageSize()
Page Size.
void clearOCRData()
Delete all pages from the internal HOCRDocument.
void clearResolutionOverride()
Set horizontal and vertical override resolution to zero.
void setTitle(const QString &title)
Set the title string in the PDF/A meta data.