[Qt-interest] Determine if the contents do not fit on a printer page

Anatoly Burakov burakov.anatoly at gmail.com
Fri Jul 16 01:56:50 CEST 2010


Hi all

I am trying to solve this problem for a long time and i still can't
figure out how to reliably determine whether the given webpage does or
does not fit on one printer page. I am looking for a universal
(independent of anything) way of determining whether the page exceeds
the printer height (I am using HTML and QWebPage for printing).

From my initial experimentation i found out that the width and height of
either webpage or a printer do not matter since i was able to print
everyting on a page that exceeded the QPrinter::width() /
QPrinter::height() values (e.g. the QWebPage reported 900+ height while
the printer's height was around 700, and the printing went OK). Another
thing i tried (to varying degree of success) was determining the
height/width ratio of a printer and then checking if the page dimensions
exceed the ratio (the page is landscape). However, this does not always
work as expected, and i really don't quite understand why (the page
itself is fully flexible, not a single fixed-size element). I am
thinking of maybe playing around with resolutions (DPI) but i am very
sceptical about it since this doesn't really have anything to do with
printer resolution.

If anyone has any ideas or solutions to this problem i would be very
grateful.

Best regards,
Anatoly

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5238 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100716/db604242/attachment.bin 


More information about the Qt-interest-old mailing list