QT 6 PDF printer not embedding font properly
-
Hi together.
I've recently switched to Qt 6 and experiencing some problems with QPdfWriter and QPrinter (printing pdf). The Font is always not embedded properly, even it is installed. To test that, I tried following Code:(Added in .pro file) QT += printsupport QPdfWriter writer("C:/Users/GGG/Desktop/lol.pdf"); writer.setResolution(300); writer.setPageSize(QPageSize(QPageSize::A4)); writer.newPage(); QPainter painter; painter.begin(&writer); painter.drawText(600,600,"Hello, this is a test"); painter.end();
-> Font is embedded fine with Qt 5.15.2, but no more with Qt 6.0.0 :(
Can one of you test my Code (Run with Qt 6 and open the .pdf file) and give your feedback? I checked everything on my System... I fear it's a Qt 6 specific problem.
Or does someone have any advice? I tested following things:
-
Check the doc's and internet -> didn't found anything useful
-
read out the font (there is one embedded, but faulty)
-
Change font of QPainter to "Calibri"
-
check if the font is aviable with db.hasFamily("Calibri"); (return value = true)
-
Check graphics card driver -> installed rightly, no updates aviable.
-
Rebuild with Qt 5.15.2 (in both cases MinGW64) -> Font is embedded correctly. But gone if I turn back to Qt version 6.0.0
-
Checked my QT components -> I have installed for Qt 6.0.0: MinGW 8.1.0 64Bit, Sources, Qt 5 compatibility Module, Qt Shader Tools, Qt Debug Information Files.
-
list itemtried the same with QPrinter wich prints Pdf files - same behaviour.
My Setup:
Windows 10, 64bit - used fonts are installed.
Qt creator 4.14.0 - MinGW64 with Qt 6.0.0 -
-
Ok, thank you a lot for your effort. It looks like you had the same problem. If I open your file with Adobe reader, the Font isn't embedded properly. According to that, I guess it's not a problem caused by my system.
Are there any faults in my code or could the problem be in Qt6? And if so, does anyone know the best way to report the bug?
Hi
Looks like something in Qt6.Open bug report here
https://bugreports.qt.io/secure/Dashboard.jspa
please attach a small runnable example app and
all information possible. maybe screenshot of the text in the pdf when right and when not.Also maybe short info on how you check in Adobe Reader.
(i don't have that installed so could not check)but just from the fact, the same code on the same system produces different looking PDF
depending on Qt5 or Qt6. then I would say something is up.Please post the bug ticket link here so other can vote on the issue.
-
Hi
resulting pdf. win 10. qt6 mingw
https://www.dropbox.com/s/jxamlp1ub2dd9ak/lol2.pdf?dl=0 -
Ok, thank you a lot for your effort. It looks like you had the same problem. If I open your file with Adobe reader, the Font isn't embedded properly. According to that, I guess it's not a problem caused by my system.
Are there any faults in my code or could the problem be in Qt6? And if so, does anyone know the best way to report the bug?
-
Ok, thank you a lot for your effort. It looks like you had the same problem. If I open your file with Adobe reader, the Font isn't embedded properly. According to that, I guess it's not a problem caused by my system.
Are there any faults in my code or could the problem be in Qt6? And if so, does anyone know the best way to report the bug?
Hi
Looks like something in Qt6.Open bug report here
https://bugreports.qt.io/secure/Dashboard.jspa
please attach a small runnable example app and
all information possible. maybe screenshot of the text in the pdf when right and when not.Also maybe short info on how you check in Adobe Reader.
(i don't have that installed so could not check)but just from the fact, the same code on the same system produces different looking PDF
depending on Qt5 or Qt6. then I would say something is up.Please post the bug ticket link here so other can vote on the issue.
-
@mrjj said in QT 6 PDF printer not embedding font properly:
Please post the bug ticket link here so other can vote on the issue.
Perfect. Thanks for your answer and help. I searched on the bugreports page. Someone posted this bug alredy.
See here for more details: https://bugreports.qt.io/browse/QTBUG-89727 -
Very nice and subtle bug - the container size was changed from int32_t to int64_t and the font serialization simply used QByteArray::size() without a cast.
-
Very nice and subtle bug - the container size was changed from int32_t to int64_t and the font serialization simply used QByteArray::size() without a cast.
@Christian-Ehrlicher Thanks for researching and fixing the error.
That will allow me to continue using Qt 6.0 without revert my code to 5.15.
-
It was just luck - and the easy testcase. :)