QTextDocument large distance between images
Solved
General and Desktop
-
Hi!
I use qt 5.15
I adding images in QTextDocument and in QTextDocument to be large distance between images. More empty space is added before and after the narrow image.QTextDocument textDocumentForPdf; QTextCursor cursor(&textDocumentForPdf); int widthPdf = widthImages * 0.9; int heightPdf = widthPdf * 1.41; for (int i = 0; i < m_arrDataForWriteReport.count(); i++) { cursor.insertImage(m_arrDataForWriteReport[i].m_image); cursor.insertImage(tableImages[i].scaled(widthImages, tableImages[i].height() * double((double)widthImages / tableImages[i].width()), Qt::KeepAspectRatio)); } QPdfWriter writer(urlPath.toLocalFile() + ".pdf"); writer.setPageSize(QPageSize(QSize(widthPdf, heightPdf))); textDocumentForPdf.print(&writer);
-