Warning, file /utilities/skanpage/src/DocumentSaver.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /**
0002  * SPDX-FileCopyrightText: 2021 by Alexander Stippich <a.stippich@gmx.net>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef DOCUMENT_SAVER_H
0008 #define DOCUMENT_SAVER_H
0009 
0010 #include <memory>
0011 
0012 #include <QObject>
0013 #include <QFileInfo>
0014 #include <QList>
0015 #include <QUrl>
0016 #include <QImage>
0017 #include <QPainter>
0018 #include <QPdfWriter>
0019 
0020 #include "SkanpageUtils.h"
0021 
0022 class OCREngine;
0023 
0024 class DocumentSaver : public QObject
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit DocumentSaver(QObject *parent = nullptr);
0030     ~DocumentSaver();
0031 
0032     void saveDocument(const QUrl &fileUrl, const SkanpageUtils::DocumentPages &document, const SkanpageUtils::FileType type, const QString &title);
0033     void saveNewPageTemporary(const int pageID, const QImage &image);
0034     void setOCREngine(OCREngine *engine);
0035 
0036 Q_SIGNALS:
0037     void showUserMessage(SkanpageUtils::MessageLevel level, const QString &text);
0038     void fileSaved(const QList<QUrl> &fileUrls, const SkanpageUtils::DocumentPages &document);
0039     void sharingFileSaved(const QList<QUrl> &fileUrls);
0040     void pageTemporarilySaved(const int pageID, const SkanpageUtils::PageProperties &page);
0041 
0042 private:
0043     void savePDF(const QUrl &fileUrl, const SkanpageUtils::DocumentPages &document, const SkanpageUtils::FileType type);
0044     void saveImage(const QFileInfo &fileInfo, const SkanpageUtils::DocumentPages &document, const SkanpageUtils::FileType type);
0045     void saveSearchablePDF(const QUrl &fileUrl, const SkanpageUtils::DocumentPages &document, const QString &title);
0046     void printPage(QPdfWriter &writer, QPainter &painter, const SkanpageUtils::PageProperties &page, bool firstPage);
0047     OCREngine *m_OCREngine;
0048 };
0049 
0050 #endif // DOCUMENT_SAVER_H