Improvements to printing portal #2016
Replies: 6 comments 33 replies
|
At LAS we discussed that we should try giving a look at what this API looks like on other platforms. Here are my findings: iOS: main print APIiOS has something similar-ish to a potential future chatty portal: the OS gives the app a There are a few different mutually-exclusive ways that an app feeds the data-to-print into iOS's printing API:
In summary, the app gives the platform an object that knows how to render the contents of the document given any set of print settings. The platform can then use this object to re-render individual pages for a print preview, and finally uses the same object to print the real document once the user confirms the print operation. iOS: secondary print APIiOS seems to have a second print API that goes something like this:
I suspect this is here because the main print API doesn't have the option for an app to include app-specific printing settings. So instead, apps would have to implement the printing UI entirely on their own? Unclear AndroidAndroid's print API is rather similar to the custom-rendering case of iOS. The app subclasses the
To print a document:
macOSmacOS uses the AppKit printing framework, and there's a fundamental difference here with the mobile APIs. The print dialog is handled in-process of the app! This lets the app inject its own settings into the dialog, simply by directly inserting its own widgets into the dialog (the dialog provides an API for the app to create its own settings section and add UI there) This means that apps have permission to access the full list of known printers, printer settings, etc. Translating this into Linux-speak, it would be like having the print portal be a proxy for the Common Print Dialog Backends. Perhaps there might be a permission prompt for "allow the app to access printers" but then after that the app can do whatever it wants. macOS's print API is integrated deep into the UI toolkit, and it obtains the data-to-print by rendering UI tooklit widgets. Apps create a print dialog and point it at a widget, attach any extra app-specific settings to the dialog, and then finally run the print operation. This causes the dialog to appear, and the print settings are used to tweak the widget tree's rendering/layout as they change, and the widget as re-rendered into the print preview (and final print output) Conclusions/Observations
|
|
I wonder: would the Common Print Dialog Backends have some sort of standardized way to communicate a list of custom settings to the dialog UI? Or is it relying on the dialog to know what that specific setting is and have specific code to render that setting? I'm wondering if we could re-use the same wire format to let apps expose arbitrary settings up into the print dialog without needing the print dialog to have knowledge of all the possible settings an app may request. We do have some precedent to add app-controlled settings to portal UI. See |
|
@swick wrote in an e-mail reply:
I think the same and for how to name it, I would use |
|
Hello All, The core problem, as I understand it:
My Proposed direction: A single long-lived call with D-Bus signals.
This turns the interaction into a signal-driven feedback loop rather than a series of disconnected method calls. Key design points:
Regards, @AdrianVovk replied:
I agree with (1), this design makes more sense. As for (2): In org.freedesktop.portal.Print.PreparePrint, when calling
The settings to be used for printing depend on the printer's capabilities, and in case of CPDB they are queried by the backend and provided to the Print Dialog when the Print Dialog is opened, but the apps themselves may also provide an "initial set of settings" that can be merged with the settings provided by the print backends. We can use the same pattern, additionally we may need to add standardized keys to allow certain apps to pass additional settings such as header/footer toggle for browsers, scaling for spreadsheets, etc. So that portals across different Desktop Environments all agree on the same set of settings definitions and behave the same with all apps. EDIT: This actually might not be a good solution, see my reply below. |
|
For app-specific options, what has to be done in any form:
|
|
If there is a revision, I'd also want to drop SVG support. The reason is that the multi-page SVG working draft was dropped, and many SVG renderers do not support it. Programs that generate multi-page output would therefore have to choose a page to render to SVG, or generate a non-compliant SVG. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Right now the printing portal exposes two UX flows:
Simplified: app has a document ready to go, calls
Print(), the portal presents a dialog to choose a printer and edit some page settings, and finally printsTwo-step: app doesn't have a document ready to go. Calls
PreparePrint(), the portal presents a dialog to choose a printer and page settings. Next, app can present its own dialog with additional print settings and possibly a preview. Once user confirms the operation, app callsPrint()and the portal skips an extra dialog due to the previousPreparePrint()callThese flows have some problems:
The portal dialog lacks a preview, and so it's hard for the user to guess what the result of their various changes will be. Even if the app has its own preview dialog, the UX of having to re-open the portal dialog to change some page settings is sub-optimal
Apps may want to have their own settings to incorporate into the print dialog. For instance: browsers may have a setting to show/hide the header/footer; presentation apps may have settings regarding the inclusion of speaker notes; etc.
This discussion is about finding ways to address these problems. I see a few potential solutions:
- This would mean each app would have its own inconsistent printing UI...
- Another negative is that toolkits would probably have to handle this printing UI, but toolkits like GTK explicitly want to move away from handling printing due to its simultaneous complexity and niche-ness (i.e. very few apps need to ever print anything)
All reactions