[Qt-interest] Printing a (local) webpage with images
Jason H
scorp1us at yahoo.com
Thu May 26 18:58:48 CEST 2011
I believe QTextDocument will do what you want.
Try to break it down, make sure it isn't a timing issue. What is missing? jpgs?
GIFs?
Maybe enlarge the size of the cache?
----- Original Message ----
From: Mathias Waack <Mathias.Waack at rantzau.de>
To: qt-interest at qt.nokia.com
Sent: Thu, May 26, 2011 10:35:12 AM
Subject: [Qt-interest] Printing a (local) webpage with images
Hi all,
I'm trying to print a webpage. The problem is (at least from my understanding)
this fact:
[see QWebFrame::setContent]
The data is loaded immediately; external objects are loaded asynchronously.
If I print the page directly like this:
QWebView *view = ...;
view->setHtml(... /* a QString containing some <img src="file://..."> tags*/);
QPrinter printer;
printer.setPageMargins(20,5,5,5,QPrinter::Millimeter);
printer.setOutputFileName(pdfFileName);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPageSize(QPrinter::A4);
view.print(&printer);
in some cases some images are missing on the pdf. Thus I assume the problem is
the above sentence. Even waiting for the "void loadFinished(bool ok)" signal
does not solve my problem.
I there a way to ensure all external objects in the page are loaded and the
document is ready for printout?
Thanks!
Mathias
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list