English 中文(简体)
如何在不使用网络浏览器控制的情况下印刷网页
原标题:How to print a web page without using the WebBrowser control

我们正在使用客户申请,从网上申请中打印职等表。

This has been working flawlessly until the systems were upgraded to IE 8. I now receive this error (Access Denied): http://img707.imageshack.us/img707/5259/62270489.png
Apparently, this is a known issue and it cannot be solved.

我如何在不使用E WebBrowser控制的情况下,从温带应用中印刷超文本?

感谢

Martin Wiboe

最佳回答

这一“远景”工作: 如果你使用办公室自动化,而html则足够基本,你可以要求html和文字印刷?

<>亮度>其他值得探讨的想法:

将Html含量转换为PDF,并节省/印本。

问题回答

解决老问题的可能性:

在从网上浏览器印刷多份文件时。 网上浏览器控制只有1例,可导致查阅否认的错误。

每份文件使用新的变量印刷,而不在全球使用。 在WebBrowserDocumentCompletedEventHandler等活动操作员将投影仪投到网上浏览器上。

WebBrowser browser = (WebBrowser)sender;

如果处理网上浏览器,仍有一些公开的印刷资源,则可能出现否认的错误。

Regards, M.

hmm 有趣的错误,我前面已经看到,我建议你使用

www.un.org/Depts/DGACM/index_spanish.htm 一些参考资料:

Embedding Gecko(Mozilla rendering engine) in a .Net application

GeckoFX is a Windows Forms control written in clean, commented C# that embeds the Mozilla Gecko browser control in any Windows Forms Application. It also contains a simple class model providing access to the HTML and CSS DOM.

我正在从SkyVE s www.GeckoFx -而不是WebBrowser-,但自Michel van Engelens/到这一问题上,我可以在此补充我的想法。 也可适用于网上浏览器。

最重要的部分是将印刷呼吁与文件汇编活动分开——我只是在这里用一个时间。

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
    Try
        Dim wb As New Skybound.Gecko.GeckoWebBrowser
        AddHandler wb.DocumentCompleted, AddressOf PrintWebBrowser_DocumentCompleted
        AddHandler wb.HandleCreated, AddressOf PrintWebBrowser_HandleCreated
        wb.CreateControl()
    Catch ex As Exception
        MsgBox(String.Format("Error trying to create GeckoWebBrowser: {0}", ex.Message))
    End Try
End Sub

Private Sub PrintWebBrowser_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim wb = DirectCast(sender, Skybound.Gecko.GeckoWebBrowser)
    wb.Navigate(GeckoWebBrowser1.Url.AbsoluteUri)
End Sub

Private Sub PrintWebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim wb = DirectCast(sender, Skybound.Gecko.GeckoWebBrowser)
    If wb.Url IsNot Nothing AndAlso wb.Url.AbsoluteUri = "about:blank" Then Exit Sub

    Dim tmr As New Timer
    tmr.Interval = 200
    AddHandler tmr.Tick, AddressOf TimerTick
    tmr.Tag = wb
    tmr.Start()
End Sub

Private Sub TimerTick(ByVal sender As Object, ByVal e As EventArgs)
    Dim tmr As Timer = DirectCast(sender, Timer)
    tmr.Stop()

    Dim wb As Skybound.Gecko.GeckoWebBrowser = Nothing
    Try
        wb = DirectCast(tmr.Tag, Skybound.Gecko.GeckoWebBrowser)
        wb.Window.Print()
    Catch comEx As Runtime.InteropServices.COMException
        Dim hresult As Integer = Runtime.InteropServices.Marshal.GetHRForException(comEx)
        If hresult = &H80004004 Then //  EX_ABORT
            MsgBox("Print cancelled")
        Else
            MsgBox(String.Format("Print failed: {0}", comEx.Message))
        End If
    Catch ex As Exception
        MsgBox(String.Format("Print failed: {0}", ex.Message))
    Finally
        If wb IsNot Nothing Then wb.Dispose()
    End Try
End Sub

我将探讨是否有可能利用丰富的文字编辑来翻译,然后印刷《区域协调手册》的内容。 我很想知道我是否取得了成功。





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签