Bug 75544
Summary: | [GTK][META] Add printing support to WebKit2 | ||
---|---|---|---|
Product: | WebKit | Reporter: | Carlos Garcia Campos <cgarcia> |
Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | bugs-noreply, gustavo, mrobinson, noein93, xan.lopez |
Priority: | P2 | Keywords: | Gtk |
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | Linux | ||
Bug Depends on: | 79226, 76172, 76448, 76536, 76616, 77197, 78715, 78793, 78799, 78805, 78823 | ||
Bug Blocks: |
Carlos Garcia Campos
The UI client has a callback to request printing a frame. The main problem is that printing happens in the WebProcess, but the GtkPrintOperation is created in the UI process. The GtkPrintOperation creates the cairo context we should render into (UI). A solution might be not using GtkPrintOperation and create the print dialog in the UI process with GtkPrintUnixDialog and GtkPrintJob directly.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Martin Robinson
Hrm. The issue with just passing a bitmap here is that we'd like to render onto a PDF surface, right?
Carlos Garcia Campos
Right, we can't use bitmaps, the surface created by GtkPrintOperation might be pdf or ps when using cups, ps when using papi and lpr, pdf, ps or svg when printing to a file and win32 printing surface in windows.
Another solution might be to run the print dialog in the web process like we currently do for auth dialogs. I don't like the idea but it might work.
Carlos Garcia Campos
Chromium uses GtkPrintUnixDialog + GtkPrintJob in unix FWIW.
Gustavo Noronha (kov)
For the record, I'm pro the creation of the dialog in the UI process with the settings then piped through the IPC to the web process for the actual printing, like Carlos proposed, and with the creation of the WebKitPrintOperation object.
Carlos Garcia Campos
Yes, the idea is to use GtkPrintDialogUnix in the UI process, without exposing it in the API, using WebKitPrintOperation, the same way GtkPrintOperation does. This way someone could add win32 support using the window native printing dialog, using the same API. This object will run the dialog and send the print settings and page setup to the web process thought IPC. In the web process a GtkPrintJob object will be created using the print settings. GtkPrintJob creates the cairo surface using gtk printing backends. Then the frame is rendered into the printing surface and the job sent to the printer. This is the general ideal for the basic functionality.
Carlos Garcia Campos
Making this a meta bug since I'm going to split the work into several patches:
- Initial printing support in WebProcess
- Initial API
- Manual capabilities (copies, collate, reverse, multiple pages per sheet, scale, etc.). Maybe using a different bug per capability.