summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-08 10:03:12 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-11 06:57:46 +0000
commitf7cde55256c0a0d7d1d87569bfc47aa35b8b7c64 (patch)
treeb180644dd1357c6dead3f0392a7b16f3865a976b /src/webenginewidgets/api
parent4338bcbacf467c0d0d7aec36fbd186ca6b9e02f6 (diff)
Add back the rest of the lost printing documentation
Pick-to: 6.2 Change-Id: I35a4857d873559403d0574a69c59b4fd1e9a952f Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/webenginewidgets/api')
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 047c682df..65b53103a 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -946,6 +946,34 @@ QWebEngineContextMenuRequest *QWebEngineView::lastContextMenuRequest() const
return d->m_contextRequest;
}
+/*!
+ \fn void QWebEngineView::pdfPrintingFinished(const QString &filePath, bool success)
+ \since 6.2
+
+ This signal is emitted when printing the web page into a PDF file has
+ finished.
+ \a filePath will contain the path the file was requested to be created
+ at, and \a success will be \c true if the file was successfully created and
+ \c false otherwise.
+
+ \sa printToPdf()
+*/
+
+/*!
+ Renders the current content of the page into a PDF document and saves it
+ in the location specified in \a filePath.
+ The page size and orientation of the produced PDF document are taken from
+ the values specified in \a pageLayout.
+
+ This method issues an asynchronous request for printing the web page into
+ a PDF and returns immediately.
+ To be informed about the result of the request, connect to the signal
+ pdfPrintingFinished().
+
+ If a file already exists at the provided file path, it will be overwritten.
+ \since 6.2
+ \sa pdfPrintingFinished()
+*/
void QWebEngineView::printToPdf(const QString &filePath, const QPageLayout &layout)
{
#if QT_CONFIG(webengine_printing_and_pdf)
@@ -962,6 +990,20 @@ void QWebEngineView::printToPdf(const QString &filePath, const QPageLayout &layo
#endif
}
+/*!
+ Renders the current content of the page into a PDF document and returns a byte array containing the PDF data
+ as parameter to \a resultCallback.
+ The page size and orientation of the produced PDF document are taken from the values specified in \a pageLayout.
+
+ The \a resultCallback must take a const reference to a QByteArray as parameter. If printing was successful, this byte array
+ will contain the PDF data, otherwise, the byte array will be empty.
+
+ \warning We guarantee that the callback (\a resultCallback) is always called, but it might be done
+ during page destruction. When QWebEnginePage is deleted, the callback is triggered with an invalid
+ value and it is not safe to use the corresponding QWebEnginePage or QWebEngineView instance inside it.
+
+ \since 6.2
+*/
void QWebEngineView::printToPdf(const QWebEngineCallback<const QByteArray&> &resultCallback, const QPageLayout &layout)
{
#if QT_CONFIG(webengine_printing_and_pdf)
@@ -985,9 +1027,9 @@ void QWebEngineView::printToPdf(const QWebEngineCallback<const QByteArray&> &res
\since 6.2
This signal is emitted when the JavaScript \c{window.print()} method is called.
- Typically, the signal handler can simply call printToPdf().
+ Typically, the signal handler can simply call print().
- \sa printToPdf()
+ \sa print()
*/
/*!