示例#1
0
        // This is called when the page asks to be printed, usually as result of
        // a window.print().
        private void OnPrintRequest(object sender, PrintRequestEventArgs e)
        {
            if (!webView.IsLive)
            {
                return;
            }

            // You can actually call PrintToFile anytime after the ProcessCreated
            // event is fired (or the DocumentReady or LoadingFrameComplete in
            // subsequent navigations), but you usually call it in response to
            // a print request. You should possibly display a dialog to the user
            // such as a FolderBrowserDialog, to allow them select the output directory
            // and verify printing.
            int requestId = webView.PrintToFile(@".\Prints", PrintConfig.Default);

            Debug.Print(String.Format("Print request {0} is being printed to {1}.", requestId, @".\Prints"));
        }
示例#2
0
 /// <summary>Handle `window.print()` events</summary>
 private void WebControl_PrintRequest(object sender, PrintRequestEventArgs e)
 {
     this.Print();
     e.Handled = true;
 }