Hi,
What is the rpt variable that you use ? Your variable names are rather cryptic.
Typically, you write a method that prints your entire report, be it either 1 page or multiple pages. For starting a new page, just use QPrinter::newPage(). Something like this :
void CMainForm
::paintMyReport( QPrinter * printer
) {
painter.begin(printer);
for( int nPage=0; nPage<m_nLastPage; nPage++ )
{
// print your page
if( nPage<m_nLastPage-1 )
printer->newPage();
}
painter.end();
}
void CMainForm::paintMyReport( QPrinter * printer )
{
QPainter painter;
painter.begin(printer);
for( int nPage=0; nPage<m_nLastPage; nPage++ )
{
// print your page
if( nPage<m_nLastPage-1 )
printer->newPage();
}
painter.end();
}
To copy to clipboard, switch view to plain text mode
If you want to print it with a preview, do this :
QPrintPreviewDialog dlgPrint;
connect( &dlgPrint,
SIGNAL(paintRequested
(QPrinter*)),
SLOT(paintMyReport
(QPrinter*)) );
dlgPrint.exec();
QPrintPreviewDialog dlgPrint;
connect( &dlgPrint, SIGNAL(paintRequested(QPrinter*)), SLOT(paintMyReport(QPrinter*)) );
dlgPrint.exec();
To copy to clipboard, switch view to plain text mode
If you want to print it directly, do this :
printer.setPrinterName( "CutePDF Writer" );
paintMyReport( &printer );
QPrinter printer;
printer.setPrinterName( "CutePDF Writer" );
paintMyReport( &printer );
To copy to clipboard, switch view to plain text mode
Regards,
Marc
Bookmarks