QPrinter fail in save pdf with japanese characters
-
Hi all
Found a strange behaviour using QPrinter for create pdf. The following snippet doesn't create a valid pdf if character to print are japanese kanji:
QPrinter Printer(QPrinter::HighResolution); QPainter PrinterPainter; Printer.setOutputFormat(QPrinter::PdfFormat); Printer.setPaperSize(QPrinter::A4); Printer.setOutputFileName(PdfFileName); PrinterPainter.begin(&Printer); PrinterPainter.drawText(0, 0, "漢字"); PrinterPainter.end();
If I use same code but for send to printer it print correctly japanese character but into pdf fail. I'm quite sure this code worked in qt version 5.7. Qt official example "Text Edit" show same behaviour and fail to save text with japanese characters.
Someone experimented same problem and have suggestions? -
Hi! Just tested it with Qt 5.7.1, and it works as expected. With what Qt version doesn't it work for you?
-
Hi
Thank you for your fast reply. I recently moved to new 5.8 and started to see the problem...
@Suppaman Okay. I don't have 5.8 at hand right now, but I will test it tomorrow.
-
-
@Wieland As already said you don't need to develop a specific software for make this test, the standard Qt "Text Editor" example show same problem as described. My platform is Windows 10, I'll try to test in different platform in the meanwhile.
-
Tested also on Windows 7 (the Qt "text edit" example) and same problem. The strange thing is if I remove the
Printer.setOutputFormat(QPrinter::PdfFormat);
line, that's mean paint on the printer, it work as expected and japanese characters are printed correctly.
-
Tested also on Windows 7 (the Qt "text edit" example) and same problem. The strange thing is if I remove the
Printer.setOutputFormat(QPrinter::PdfFormat);
line, that's mean paint on the printer, it work as expected and japanese characters are printed correctly.
-
Seem someother alredy report this bug: https://bugreports.qt.io/browse/QTBUG-58692
-
On Windows 7, it fails for me, too.