1

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

Furqan Sehgal
  • 4,917
  • 33
  • 108
  • 167

1 Answers1

0

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
Harsh
  • 3,683
  • 2
  • 25
  • 41