Skip to content

Commit d027b90

Browse files
committed
#3399 export: set colormode to color more often
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 157ebe2 commit d027b90

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# QOwnNotes Changelog
22

3+
## 25.12.2
4+
5+
- Try to fix PDF export not generating color output on some computers
6+
- The printer color mode is now explicitly set to color at multiple strategic points during PDF export
7+
- This ensures color PDFs are generated regardless of saved printer settings or system defaults
8+
- The fix applies to all platforms (Linux, Windows, macOS)
9+
310
## 25.12.1
411

512
- A lot of refactoring was done to fix build warnings for Qt6, while maintaining

src/mainwindow.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5417,6 +5417,9 @@ bool MainWindow::prepareExportNoteAsPDFPrinter(QPrinter *printer) {
54175417
#ifdef Q_OS_LINUX
54185418
Utils::Misc::loadPrinterSettings(printer, QStringLiteral("Printer/NotePDFExport"));
54195419

5420+
// Ensure color mode is always set to Color for PDF export
5421+
printer->setColorMode(QPrinter::Color);
5422+
54205423
// under Linux we use the QPageSetupDialog to change layout
54215424
// settings of the PDF export
54225425
QPageSetupDialog pageSetupDialog(printer, this);
@@ -5425,11 +5428,17 @@ bool MainWindow::prepareExportNoteAsPDFPrinter(QPrinter *printer) {
54255428
return false;
54265429
}
54275430

5431+
// Ensure color mode is still set to Color before storing settings
5432+
printer->setColorMode(QPrinter::Color);
5433+
54285434
Utils::Misc::storePrinterSettings(printer, QStringLiteral("Printer/NotePDFExport"));
54295435
#else
54305436
// under OS X and Windows the QPageSetupDialog dialog doesn't work,
54315437
// we will use a workaround to select page sizes and the orientation
54325438

5439+
// Ensure color mode is always set to Color for PDF export
5440+
printer->setColorMode(QPrinter::Color);
5441+
54335442
SettingsService settings;
54345443

54355444
// select the page size
@@ -5506,6 +5515,8 @@ bool MainWindow::prepareExportNoteAsPDFPrinter(QPrinter *printer) {
55065515
fileName.append(QLatin1String(".pdf"));
55075516
}
55085517

5518+
// Ensure color mode is set to Color right before setting output format
5519+
printer->setColorMode(QPrinter::Color);
55095520
printer->setOutputFormat(QPrinter::PdfFormat);
55105521
printer->setOutputFileName(fileName);
55115522
return true;

0 commit comments

Comments
 (0)