web浏览器打印设置 [英] WebBrowser print settings
问题描述
我ca的如何改变我的html文件的方向(为横向)使用WebBrowser控件进行打印。
How ca i change my html document orientation(to Landscape) for printing using WebBrowser control.
var browser = new WebBrowser();
browser.DocumentCompleted += (sender, args) =>
{
var ws = sender as WebBrowser;
//change paper size and orientation
ws.Print();
};
browser.Navigate(path);
我需要改变纸张大小格式C5和方向设置为横向打印前。 我怎样才能做到这一点没有任何对话?
I need to change paper size format to C5 and orientation to Landscape before printing. How can i do this without any dialogs?
推荐答案
要控制之外的 @媒体CSS 与 web浏览器
(包括WinForms和WPF),您将需要实现自己的 Internet Explorer的打印模板。这将提供完全控制标题,边距,列等。
To control HTML printing layout beyond @media CSS with WebBrowser
(both WinForms and WPF), you would need to implement your own Internet Explorer Print Template. That would provide full control over headers, margins, columns, etc.
具体而言,您以后 TemplatePrinter是。定向。这是不正确的记载,但它的工作原理。标准的IE打印模板的源代码可以在导航到水库查看://ieframe.dll/$p$pview.dlg
Specifically, you're after TemplatePrinter.orientation. It isn't properly documented, but it works. The source of the standard IE print template can be viewed when navigated to res://ieframe.dll/preview.dlg
.
其他的一些相关的资源:
Some other relevant resources:
- 除了打印preVIEW:打印定制的Internet Explorer 5.5中
- 打印preVIEW 2:的Internet Explorer 5.5中打印定制继续冒险
- 打印模板,第一部分 对于HTML源文件
- 视图模板
- <一个href="http://marc.durdin.net/2011/07/demystifying-printing-with-the-microsoft-webbrowser-control-and-showhtmldialogex-2/"相对=nofollow>揭秘印刷与Microsoft WebBrowser控件和ShowHTMLDialogEx
- 添加支持打印和放大器;在一个基于对话框的MFC应用程序preVIEW HTML
- IDM_PRINT 李>
- IDM_PRINT preVIEW
- MSKB:如何打印的自定义页眉和页脚在Internet Explorer WebBrowser控件
- Beyond Print Preview: Print Customization for Internet Explorer 5.5
- Print Preview 2: The Continuing Adventures of Internet Explorer 5.5 Print Customization
- Print Templates, Part I
- View templates for HTML source documents
- Demystifying printing with the Microsoft WebBrowser control and ShowHTMLDialogEx
- Add support to print & preview HTML in a dialog-based MFC app
- IDM_PRINT
- IDM_PRINTPREVIEW
- MSKB: How to print custom headers and footers for a WebBrowser control in Internet Explorer
这篇关于web浏览器打印设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!