So, I'm trying to print a QWebEngineView entirely, but give a Preview Dialog, such as QPrintPreviewDialog would be sufficient.
First try was something along these lines:
self.loader = QWebEngineView()
[...]
dialog = QPrintPreviewDialog()
dialog.paintRequested.connect(self.loader.page().print)
dialog.show()
self.loader is also used as the actual view rendered to screen. In this setup I get one page sent to the preview and that is the current view in the window. But not the entire document, which is what I want.
I can simply call self.loader.page().print(), which works (prints everything) but gives me no preview option.
I then tried to be smart by using
self.loader.page().runJavaScript("window.print();")
But that doesn't appear to trigger any reaction whatsoever.
So, how do I get an entire WebView printed with a preview dialog beforehand?
In this case PyQt5/PySide2 would be preferred, but I can understand a regular Qt Solution just fine too.