RequestPrint
Interface AntViewDocument
Type: Method
Parameters: none
Returns: nothing
Invoke the print dialog from the host application.
This uses the javascript window.print(); command under the hood and does not offer any customizations.
Beware that you cannot detect if the user pressed "Ok" or "Cancel" on the print dialog.
As the request is run asynchronously, once the print dialog is closed, it will trigger the OnRequestPrintCompleted event.
There's also a synchronous alternative RequestPrintSync that wraps the above into one call.
Note that at the time we provided this feature, that Microsoft did not have a printing option besides the PrintToPdf option. Our RequestPrint feature works fine, but it is lacking fancy features.
Back then Microsoft was working on an official printing API for WebView2 (see Add API:Print #2604 and Specs Print.md), which had just gone into beta. This feature is released and will give us better control over the whole printing interface.
This will come to AntView 2.0 at a later time.
See also: PrintToPdf
Introduced in AntView release 1.1.236
AntView - The MS Edge WebView2 ActiveX control Date last changed: 04/16/2025