|Summary:||[GTK] Implement print preview in WebKit2 GTK+|
|Product:||WebKit||Reporter:||Carlos Garcia Campos <cgarcia>|
|Component:||WebKit2||Assignee:||Tomas Popela <tpopela>|
|Severity:||Normal||CC:||mcrha, mrobinson, tpopela|
|Version:||528+ (Nightly build)|
|Bug Depends on:|
Description Carlos Garcia Campos 2012-02-22 05:07:58 PST
It's currently unsupported.
Comment 1 Martin Robinson 2015-05-07 18:24:58 PDT
What all do we need to do for this?
Comment 2 Carlos Garcia Campos 2015-05-07 22:38:11 PDT
We probably need a way to send the PDF from the web process to the UI process.
Comment 3 Milan Crha 2016-02-16 06:27:54 PST
I do not know the rationale behind this, but with respect of the Gtk's print dialog, you get all of that for free, both Print Preview and Export to PDF (yes, that's also sometimes useful), if you just reuse what the gtk offer. All you need to do is to implement three signals on the GtkPrintOperation, as shown in the simple example , which can be run in gtk3-demo, Printing->Printing demo. Reuse of the code is beneficial, I believe, especially when you get things for free.  https://git.gnome.org/browse/gtk+/tree/demos/gtk-demo/printing.c#n158
Comment 4 Carlos Garcia Campos 2016-02-16 08:34:45 PST
Unfortunately this is not that easy in WebKit2 model. We run the dialog in the ui process, but the print operation in the web process. So we use the unix print dialog manually, and a custom print operation in the web process. So, the UI process simply collects the options form the print dialog, and the web process does the actual printing to a file that is sent to the printer with GtkPrintJob
Comment 6 Tomas Popela 2016-12-01 07:49:30 PST
I added a wip implementation (but it's working) just to have some opinion from other devs if this is the right way to implement this (we talked about this with Carlos during the hackfest). For the description please see the change logs.