jan
12th October 2009, 12:07
My program involve printing to a roll script which is just 8 cm width. I have set the paper size of the QPrinter accordingly. The content is rendered from a QTextDocument object. The output was cropped on the right side. Hence I would like to set the page size on the QTextDocument in order to render the content correctly. The problem is, what unit is used in the QTextDocument::setPageSize method?
Here is my code snip.
QTextDocument *lpDocument(ui.mpTextEditPrintOut->document());
QPrinter lrPrinter;
QPrintDialog* lpDlg(new QPrintDialog(&lrPrinter, this));
lrPrinter.setPaperSize(QSizeF(8.0, 10.0), QPrinter::Millimeter);
lrPrinter.setPageMargins(0.0, 0.0, 0.0, 0.0, QPrinter::Millimeter);
if (lpDlg->exec() != QDialog::Accepted)
{
return;
}
lpDocument->print(&lrPrinter);
development environment:
Qt 4.4.0.
MSVC 8.0 SP1 with Qt Visual Studio Integration 1.4.0.
Win XP SP3.
Here is my code snip.
QTextDocument *lpDocument(ui.mpTextEditPrintOut->document());
QPrinter lrPrinter;
QPrintDialog* lpDlg(new QPrintDialog(&lrPrinter, this));
lrPrinter.setPaperSize(QSizeF(8.0, 10.0), QPrinter::Millimeter);
lrPrinter.setPageMargins(0.0, 0.0, 0.0, 0.0, QPrinter::Millimeter);
if (lpDlg->exec() != QDialog::Accepted)
{
return;
}
lpDocument->print(&lrPrinter);
development environment:
Qt 4.4.0.
MSVC 8.0 SP1 with Qt Visual Studio Integration 1.4.0.
Win XP SP3.