Core: Introduce PDF Import-Export dialog (#20860)

* Core: Introduce PDF Import-Export dialog

Currently, we only have hardcoded exporting to one pdf version, which
leads to (as in one of the below issues) to problems, such as
non-transparent layers, which are by default not supported in PDF/A-1b.

So, this patch adds an option to the user to select their preferred PDF
version by introducing new dialog under Import-Export in Preferences,
and allowing to update that version before exporting.

* Core: Add informational messages regarding selected PDF format

* Gui: Handle Qt < 6.8 unsupported PDF format

* Gui: Switch PDF export prefs dialog to use tr()

* Gui: Remove center alignment of PDF version description

---------

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
tetektoza
2025-04-28 02:31:34 +02:00
committed by GitHub
parent 47c1565edf
commit b138276a15
11 changed files with 290 additions and 14 deletions

View File

@@ -44,6 +44,8 @@
#include <Base/PyWrapParseTupleAndKeywords.h>
#include <CXX/Objects.hxx>
#include <Gui/PreferencePages/DlgSettingsPDF.h>
#include "Application.h"
#include "ApplicationPy.h"
#include "BitmapFactory.h"
@@ -773,8 +775,10 @@ PyObject* ApplicationPy::sExport(PyObject * /*self*/, PyObject *args)
view3d->viewAll();
}
QPrinter printer(QPrinter::ScreenResolution);
// setPdfVersion sets the printed PDF Version to comply with PDF/A-1b, more details under: https://www.kdab.com/creating-pdfa-documents-qt/
printer.setPdfVersion(QPagedPaintDevice::PdfVersion_A1b);
// setPdfVersion sets the printed PDF Version to what is chosen in
// Preferences/Import-Export/PDF more details under:
// https://www.kdab.com/creating-pdfa-documents-qt/
printer.setPdfVersion(Gui::Dialog::DlgSettingsPDF::evaluatePDFVersion());
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
printer.setCreator(QString::fromStdString(App::Application::getNameWithVersion()));