[webkit-dev] Duplicate page: Implementing Print Preview

Marc-Antoine Ruel maruel at chromium.org
Thu May 28 11:13:17 PDT 2009

To clarify Sverrir and my intent;
PDF (or EMF as it's currently done on the windows port of Chromium) snapshot
is fine for a static print preview but useless for a dynamic one. We'd
prefer to have something interactive. If a user changes the layout or the
page setup, the print preview is immediately updated. To do that, we need to
make the print preview application modal (because of javascript
interactions) and I think it defeats the purpose of tabbed browsing.

(Please correct me if I'm mistaken)
The goal is to make the print preview in its own tab and not modal
anymore. So the idea is to duplicate the Document/Frame along
with RenderView and all their children into a new WebView, disable their
javascript, timers and url request ability. This copy would be used to
regenerate the print preview/printed document.

That's quite a daunting task, we'd like to know if we missed something
obvious (or already existing!) and if not, if anyone else would like to see
the same feature.



On Wed, May 27, 2009 at 2:05 PM, Sverrir Á. Berg <sverrir at chromium.org>wrote:

> Interesting idea.  I see two downsides to that though.  Firstly I think
> need some kind of PDF library since only Mac's have native support and when
> the user needs to change the layout of the page (margins,
> portrait/landscape) I would need to re-create the PDF again?
> Sverrir
> On Wed, May 27, 2009 at 1:03 PM, David Hyatt <hyatt at apple.com> wrote:
>> Can you render the page to PDF and display the PDF?  Maybe you could
>> render the page into bitmaps if you aren't able to support PDF.
>> dave
>> (hyatt at apple.com)
>> On May 27, 2009, at 11:53 AM, Sverrir Á. Berg wrote:
>> Hi all,
>> I'm working on Google Chrome and trying to come up with a way to implement
>> print preview.  To be able to display it in a separate tab we need to be
>> able to duplicate the current page in memory so the user can continue to
>> interact with the original page.  Javacript, animations etc should continue
>> on the original page but be frozen in the print preview version.
>> What I've tried so far is to select everything on the page
>> (Frame::selection()->SelectAll()) and Frame::GetSelection(true) but the HTML
>> does not fully describe the page and this has the downside of modifying the
>> users selection on the page.
>> I've poked around in WebKit a bit and as far as I can tell the document,
>> rendertree and the views are fairly integrated and not easy to take a
>> snapshot of the full state of the document.  I would appreciate any insights
>> on this though since I might have missed something obvious.
>> If nothing existing can be reused then adding this functionality should
>> benefit all ports.  But again I need your insights on how this can be done
>> (if at all).
>> Sverrir
>>  _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090528/74775a7e/attachment.html>

More information about the webkit-dev mailing list