Well it's not at all as simple as WebKit's view()->print(), but it's not impossible either.
One thing to keep in mind is that QWebEnginePage::print() first renders the page into a temporary PDF and then prints that. Which means that everything will be printed exactly as it's seen on your screen. That includes light text on a dark background if someone happens to have the "Make PageEdit simulate a dark appearance in Dark Mode" option checked in PageEdit's preferences.
So while I have a working proof of concept, I'm probably going to put a few guardrails on this thing so people can choose whether or not they really, really, really want to empty their black ink cartridge when printing under certain conditions!
|