Results 1 to 2 of 2

Thread: how to add header text and footer text while printing a text file

  1. #1
    Join Date
    Jun 2007
    Location
    italy
    Posts
    126
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to add header text and footer text while printing a text file

    Hi all,

    I am sending to printer a text file which has been already loaded using the code as follows:
    Qt Code:
    1. QString txtFile(txtlFile);
    2.  
    3. QFile txtFileOut(txtFile);
    4. txtFileOut.open(QFile::ReadOnly | QFile::Text);
    5. QTextStream txtFileIn(&txtFileOut);
    6. QString txtFileToQString(txtFileIn.readAll());
    7.  
    8. QTextDocument *document = new QTextDocument(txtFileToQString);
    9.  
    10. QPrinter printer;
    11.  
    12. QPrintDialog *dlg = new QPrintDialog(&printer, this);
    13. if (dlg->exec() != QDialog::Accepted)
    14. return;
    15.  
    16. document->print(&printer);
    To copy to clipboard, switch view to plain text mode 

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

  2. #2
    Join Date
    Aug 2008
    Posts
    19
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to add header text and footer text while printing a text file

    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....?content=62383

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.