summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-05-14 15:57:42 +0200
committerMontel Laurent <[email protected]>2016-05-14 15:57:42 +0200
commit14fe3d9ab1f6a632f6fe3a4a4a7949dc6a1c8938 (patch)
treebb9efa89c3147746ffccc4a92c1ba357cdb5ed38
parentb39c10da0194fc058f7eb336121aeb901c5a6677 (diff)
Create pdf file
-rw-r--r--webengineviewer/src/print/printwebengineviewjob.cpp16
-rw-r--r--webengineviewer/src/print/printwebengineviewjob.h2
2 files changed, 16 insertions, 2 deletions
diff --git a/webengineviewer/src/print/printwebengineviewjob.cpp b/webengineviewer/src/print/printwebengineviewjob.cpp
index 0367edf..649aefa 100644
--- a/webengineviewer/src/print/printwebengineviewjob.cpp
+++ b/webengineviewer/src/print/printwebengineviewjob.cpp
@@ -74,7 +74,21 @@ void PrintWebEngineViewJob::start()
void PrintWebEngineViewJob::slotHandlePdfPrinted(const QByteArray &result)
{
- //TODO
+ if (!result.size())
+ return;
+
+ QFile file(mTemporaryFile.fileName());
+ if (!file.open(QFile::WriteOnly)) {
+ //TODO warning.
+ Q_EMIT failed();
+ deleteLater();
+ return;
+ }
+
+ file.write(result.data(), result.size());
+ file.close();
+ Q_EMIT success(mTemporaryFile.fileName());
+ deleteLater();
}
QPageLayout PrintWebEngineViewJob::pageLayout() const
diff --git a/webengineviewer/src/print/printwebengineviewjob.h b/webengineviewer/src/print/printwebengineviewjob.h
index 757b697..3173835 100644
--- a/webengineviewer/src/print/printwebengineviewjob.h
+++ b/webengineviewer/src/print/printwebengineviewjob.h
@@ -44,7 +44,7 @@ public:
Q_SIGNALS:
void failed();
- void success();
+ void success(const QString &temporaryFileName);
private Q_SLOTS:
void slotHandlePdfPrinted(const QByteArray &result);