I am creating a PDF file using QPrinter in Qt4.8,
QPrinter printer(QPrinter::HighResolution);
QTextDocument document;
document.setHtml(html);
printer.setOrientation(QPrinter::Landscape);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFileName(fName);
// printer.setFullPage(true);
// printer.setMargins({ 20, 20, 20, 20});
// printer.setPageMargins(QMarginsF(10, 10, 10, 10));
document.documentLayout()->setPaintDevice(&printer);
document.setPageSize(printer.pageRect().size());
document.print(&printer);
But the result is very ugly text as in this image (rectangle in the below):
What is interesting is that following this answer, at some point I could get a very clear text as in the top rectangle in the image. But during refactoring something seems to be changed and I cannot get clear PDF files anymore. I tried every possible ways I know. No result. Could you help me?
BTW, in the Ubuntu laptop a PDF file is fine, but in the target device (Embedded Linux) the resulted PDF is not clear.
PS: I forgot to commit the working code, therefore this problem.