print html rendered page from asp .net server

M

mygroup

Hello Folks,
I have an asp.net application which requires to fill a form. Once the
form is completed, it should print the final page on server side (not
the client side). I tried to use SHDocVw.InternetExplorer object. It
opens up the window but it is hidden(even if it I make visible
property to True). If I given print command, it does nothing. Here is
my code.
I have added reference of Interop.SHDocVw.dll

Imports System.Threading
Try
Dim o As Object
Dim result As Object
ie.Navigate("http://localhost/Default.aspx", o, o, o, o)
ie.Visible = True
While ie.Busy
Thread.Sleep(300)
End While
ie.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, o, o)
Catch ex As Exception
Response.Write("<br>Error occurred<br>")
Response.Write(ex.Message)
'Response.Write("<br>" & ex.InnerException.ToString)
End Try

When I run this code, no error occurs but IE window is hidden. (In
process list it shows IE) For printing, it does not do anything.
Is there anyway I can get server side printing in asp .net?

Thanks
 
G

George Ter-Saakov

Printers are specific to account.
So if you installed printer they will be installed only under account you
logged in with.

ASP.NET runs under different account so it simply does not have printers
available.

Google "print from NT service" to find out how to setup printers for ASP.NET
account

George.
 
M

mygroup

I have given permission to ASP .Net account to use printer but it is
not working. I can hear some sounds as if some error occurred but it
is not visible to me because IE window is not visible even if I made
Visible = True. Is there any other way around to print on server side?
 
B

bruce barker

services like asp.net can not access the desktop, so there is no way to show
a window. also no default printer is setup for a service as its running
without a standard profile.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top