tags:

views:

352

answers:

1

When printing from WebKit, it seems to automatically impose a shrink factor on the output. Is there a way to disable shrinking when printing, preferably without modifying the WebKit source?
I think it may be possible using Qt 4.6 trunk and using setFixedLayout with a longer height, to trick WebKit into not shrinking, but I haven't tried it yet. Maybe there is a way to get at the underlying WebKit so I can do this?

EDIT: Chrome deals with this by extending the print layout height.
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/print_web_view_helper.cc?view=markup

+2  A: 

It's not possible to do with QT 4.5, as I ran into that issue a couple of months ago myself. I don't now about Qt 4.6, though.

The culprit is in src/3rdparty/webkit/WebCore/page/PrintContext.cpp on line 103 and 109. As you see the shrinking factor is not even constant but is calculated so that the content fits best on the available printing area.

Setting both variables to 1 resolves the problem. I analyzed the problem back then very thoroughly and I didn't came up with a better solution than patching Qt.

sebasgo