だけでは、PDFの例available from Qtに、一般的なHTMLを試してみました。ここで
は私のhtmlコードです:
Chromeで次のようにレンダリングし
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>title</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>Words separated with non breakable space</p>
<p>Lorem ipsum dolor sit amet, consectitur adipisci elit.</p>
</body>
</html>
:QTextDocumentクラスを経由して、PDFへの変換、単純なHTMLを使用して次に

:
#include <QApplication>
#include <QString>
#include <QPrinter>
#include <QTextDocument>
#include <QWidget>
#include <QFileDialog>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString fileName = QFileDialog::getSaveFileName((QWidget*)0, "Export PDF", QString(), "*.pdf");
if (QFileInfo(fileName).suffix().isEmpty()) { fileName.append(".pdf"); }
QPrinter printer(QPrinter::PrinterResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(QPrinter::A4);
printer.setOutputFileName(fileName);
QTextDocument doc;
doc.setHtml("<h1>Hello, World!</h1><p>Words separated with non breakable space</p><p>Lorem ipsum dolor sit amet, consectitur adipisci elit.</p>");
doc.setPageSize(printer.pageRect().size()); // This is necessary if you want to hide the page number
doc.print(&printer);
return a.exec();
}
これをレンダリングする出力PDFファイルを与えます: 
私はスペースが削除されていないことがわかっています。 このコードスニペットは、あなたが望むものを達成するのに役立ちますか?
またはあなたの簡単なコンパイルの例を供給することができますので、私たちが間違っているかどうか確認できますか?