SSRS Printing without showind Print Dialog

折月煮酒 提交于 2019-12-11 09:43:42

问题


I am rendering an SSRS datareport. I want to print it directly, without showing it on screen and without even showing the printer dialogue. I can send it to the printer without showing on screen but it displays the Print Dialog. How to avoid this?

Thanks


回答1:


Make use of threading here. Once the print command is given just start a thread which will simulate the key press required to close the window..

Here is a sample code which closes a dialogue box which requires enter key to be pressed.

Start the thread after print starts:

'Declare a thread object to do the keyboard press events.
 Dim thrd as Thread

    thrd = New Thread(AddressOf ThreadTask)
    thrd.IsBackground = True
    thrd.Start()

This is the thread task, which here is to simulate enter key press which results in closing the window. You can use escape key if it works for you

Private Sub ThreadTask()
    Thread.Sleep(100)
    SendKeys.SendWait("{TAB}")
    Thread.Sleep(10)
    SendKeys.SendWait("{ENTER}")
End Sub


来源:https://stackoverflow.com/questions/9532474/ssrs-printing-without-showind-print-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!