1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Printing to PDF with the page title

This commit is contained in:
Anmol Gautam 2018-02-16 01:41:37 +05:30 committed by David Rosca
parent 9e3423ff9e
commit 5152e514a0
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -392,14 +392,16 @@ void WebView::printPage()
{
Q_ASSERT(m_page);
QPrintDialog* dialog = new QPrintDialog(this);
QPrinter *printer = new QPrinter();
printer->setCreator(tr("Falkon %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
printer->setDocName(QzTools::filterCharsFromFilename(title()));
QPrintDialog *dialog = new QPrintDialog(printer, this);
dialog->setOptions(QAbstractPrintDialog::PrintToFile | QAbstractPrintDialog::PrintShowPageSize);
#ifndef Q_OS_WIN
dialog->setOption(QAbstractPrintDialog::PrintPageRange);
dialog->setOption(QAbstractPrintDialog::PrintCollateCopies);
#endif
dialog->printer()->setCreator(tr("Falkon %1 (%2)").arg(Qz::VERSION, Qz::WWWADDRESS));
dialog->printer()->setDocName(QzTools::getFileNameFromUrl(url()));
if (dialog->exec() == QDialog::Accepted) {
if (dialog->printer()->outputFormat() == QPrinter::PdfFormat) {