【问题标题】:Set the printer to landscape for the WebBrowser Control为 WebBrowser 控件将打印机设置为横向
【发布时间】:2011-06-03 13:25:34
【问题描述】:

我正在使用 WebBrowser 控件打印 HTML 文件,但我想强制它打印横向。我认为以下可能会解决问题,但它没有

Dim ps As New System.Drawing.Printing.PrinterSettings
ps.DefaultPageSettings.Landscape = True
WebBrowser1.ShowPrintDialog()

有什么方法可以不使用 SetPrinter API 吗?

【问题讨论】:

    标签: html vb.net .net-4.0 printing browser


    【解决方案1】:

    这是不可能的。虽然用户能够使用用户界面设置打印机设置(甚至能够选择不同的打印机),但这在编程上是不可能的。

    用户直接在注册表中设置值(对于 Internet Explorer 键)存在一些“黑客行为”,但这里的错误可能会造成问题。

    请参阅以下 Microsoft 知识库文章:http://support.microsoft.com/kb/313723 还有一个连接问题:https://connect.microsoft.com/VisualStudio/feedback/details/678232 还有另一个相关的 StackOverflow 问题:How do I programatically change printer settings with the WebBrowser control?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-08
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-12
      • 2011-11-22
      相关资源
      最近更新 更多