PDA

View Full Version : how to add header text and footer text while printing a text file



rmagro
2nd September 2008, 14:21
Hi all,

I am sending to printer a text file which has been already loaded using the code as follows:


QString txtFile(txtlFile);

QFile txtFileOut(txtFile);
txtFileOut.open(QFile::ReadOnly | QFile::Text);
QTextStream txtFileIn(&txtFileOut);
QString txtFileToQString(txtFileIn.readAll());

QTextDocument *document = new QTextDocument(txtFileToQString);

QPrinter printer;

QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (dlg->exec() != QDialog::Accepted)
return;

document->print(&printer);


How can I add header text and footer text to each page printed ??
Thank you very mutch for you contribute..
Roby

netuno
3rd September 2008, 14:16
Qt doesn't have an API to do header/footer but this lib should help you get the job done: http://www.qt-apps.org/content/show.php/TextPrinter?content=62383