public void ShowPrintDialog(nsIDOMWindow parent, nsIWebBrowserPrint webBrowserPrint, nsIPrintSettings printSettings)
        {
            const int NS_ERROR_ABORT = unchecked ((int)0x80004004);

            using (var dialog = new System.Windows.Forms.PrintDialog())
            {
                dialog.UseEXDialog = true;
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var settings = dialog.PrinterSettings;
                    printSettings.SetPrinterNameAttribute(dialog.PrinterSettings.PrinterName);
                    // Add other settings here ...
                }
                else
                {
                    throw new COMException("Operation aborted", NS_ERROR_ABORT);
                }
            }
        }