PDA

View Full Version : QPrinter's pdf engine shows wrong font, codec and margine



hind
2nd May 2013, 10:54
I am able to output document to PDF files with QPrinter, either with virtual PDF printer or the Qt's embedded PDF engine. Whole document is painted myself. It works fine with the virtual PDF printer, just as if it's a real printer. But when I set the output format of QPrinter to QPrinter::PdfFormat, the contents in the pdf file is moved right and down. The document contains Chinese charactors and some of them are wrong, seemingly caused by a wrong codec. Also I used some of the most common Chinese Fonts, all fonts are replaced by one of them.

What's the difference between the two ways? Is there any chance I can configure the Qt's PDF engine? Because I need to do batch output of PDF files I don't want the user to type the file names for each one with the virtual PDF printer, which works with no problem.

ChrisW67
3rd May 2013, 00:53
The Qt PDF "printer" device will have different default geometry to your actual printer or the PDF virtual printer. There are any number of ways for this to be broken.

Post a small, compilable program that demonstrates the problem and perhaps a good and bad PDF.

hind
3rd May 2013, 04:24
Thanks, but geometry is not my most concerned problem. There are ways around it.
The codec and font problem are more strange. Because they are all connected to Chinese it's not likely helpful to provide samples.
Why when, and only when, using the Qt's own PDF engine, some of the charactors are replaced and all fonts are replaced with one of them? I don't see any way to change this.