File indexing completed on 2025-01-26 04:57:25

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "webengineviewer_export.h"
0010 #include <QObject>
0011 class QWebEngineView;
0012 namespace WebEngineViewer
0013 {
0014 /**
0015  * @brief The WebEngineExportHtmlPageJob class
0016  * @author Laurent Montel <montel@kde.org>
0017  */
0018 class WEBENGINEVIEWER_EXPORT WebEngineExportPdfPageJob : public QObject
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit WebEngineExportPdfPageJob(QObject *parent = nullptr);
0023     ~WebEngineExportPdfPageJob() override;
0024     void start();
0025 
0026     [[nodiscard]] QWebEngineView *engineView() const;
0027     void setEngineView(QWebEngineView *engineView);
0028 
0029     [[nodiscard]] QString pdfPath() const;
0030     void setPdfPath(const QString &pdfPath);
0031 
0032     [[nodiscard]] bool canStart() const;
0033 
0034 Q_SIGNALS:
0035     void exportPdfFailed();
0036     void exportToPdfSuccess();
0037 
0038 private:
0039     WEBENGINEVIEWER_NO_EXPORT void slotPdfPrintingFinished(const QString &filePath, bool success);
0040     QString mPdfPath;
0041     QWebEngineView *mWebEngineView = nullptr;
0042 };
0043 }