src/eric7/QScintilla/Exporters/ExporterPDF.py

branch
eric7
changeset 9487
78cb053591c9
parent 9473
3f23dbf37dbe
child 9500
5771348ded12
diff -r 5a8179763e38 -r 78cb053591c9 src/eric7/QScintilla/Exporters/ExporterPDF.py
--- a/src/eric7/QScintilla/Exporters/ExporterPDF.py	Tue Nov 08 11:50:50 2022 +0100
+++ b/src/eric7/QScintilla/Exporters/ExporterPDF.py	Tue Nov 08 12:19:25 2022 +0100
@@ -11,7 +11,7 @@
 # Original code: Copyright 1998-2006 by Neil Hodgson <neilh@scintilla.org>
 
 from PyQt6.Qsci import QsciScintilla
-from PyQt6.QtGui import QFontInfo
+from PyQt6.QtGui import QColor, QFontInfo
 
 from eric7 import Preferences
 from eric7.EricGui.EricOverrideCursor import EricOverrideCursor
@@ -513,6 +513,9 @@
                             style.font |= 1
 
                         colour = lex.color(istyle)
+                        if colour.name() == "#ffffff":
+                            # map white to black for readability on paper
+                            colour = QColor("#000000")
                         style.fore = self.__getPDFRGB(colour)
                         self.pr.style[istyle] = style
 
@@ -635,3 +638,17 @@
                         """ <b>{0}</b>.</p><p>Reason: {1}</p>"""
                     ).format(filename, str(err)),
                 )
+
+
+def createExporter(editor, parent=None):
+    """
+    Function to instantiate an exporter object.
+
+    @param editor reference to the editor object
+    @type QScintilla.Editor.Editor
+    @param parent parent object of the exporter (defaults to None)
+    @type QObject (optional)
+    @return exporter object
+    @rtype ExporterPDF
+    """
+    return ExporterPDF(editor, parent=parent)

eric ide

mercurial