The OpenD Programming Language

ICoreWebView2_16.Print

Print the current web page asynchronously to the specified printer with the provided settings. See ICoreWebView2PrintSettings for description of settings. Passing nullptr for printSettings results in default print settings used.

The handler will return errorCode as S_OK and printStatus as COREWEBVIEW2_PRINT_STATUS_PRINTER_UNAVAILABLE if printerName doesn't match with the name of any installed printers on the user OS. The handler will return errorCode as E_INVALIDARG and printStatus as COREWEBVIEW2_PRINT_STATUS_OTHER_ERROR if the caller provides invalid settings for a given printer.

The async Print operation completes when it finishes printing to the printer. At this time the ICoreWebView2PrintCompletedHandler is invoked. Only one Printing operation can be in progress at a time. If Print is called while a Print or PrintToPdf or PrintToPdfStream or ShowPrintUI job is in progress, the completed handler is immediately invoked with E_ABORT and printStatus is COREWEBVIEW2_PRINT_STATUS_OTHER_ERROR. This is only for printing operation on one webview.

| errorCode | printStatus | Notes | | --- | --- | --- | | S_OK | COREWEBVIEW2_PRINT_STATUS_SUCCEEDED | Print operation succeeded. | | S_OK | COREWEBVIEW2_PRINT_STATUS_PRINTER_UNAVAILABLE | If specified printer is not found or printer status is not available, offline or error state. | | S_OK | COREWEBVIEW2_PRINT_STATUS_OTHER_ERROR | Print operation is failed. | | E_INVALIDARG | COREWEBVIEW2_PRINT_STATUS_OTHER_ERROR | If the caller provides invalid settings for the specified printer. | | E_ABORT | COREWEBVIEW2_PRINT_STATUS_OTHER_ERROR | Print operation is failed as printing job already in progress. |

\snippet AppWindow.cpp PrintToPrinter

Meta