Print HTML Page from .net application

K

Kumar.A.P.P

We have a requirement in our project to print Html page from a vb.net windows
service application. The application should not display any dialog box. The
Printer details, which varies for different Print Jobs, needs to be
programmatically set. We have found the following code on the net which can be
used to print HTML page.

Dim p As New System.Diagnostics.ProcessStartInfo
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\tEMP\NewFolder\sparsh.html"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)

The above code is printing the html file but the problem is that the printer
dialog box is displayed every time the page is printed.
Please suggest a way out where we can eliminate the Dialog Box? Any other
approach to print HTML page from .net application can also be take up.
 
M

Mark Rae [MVP]

The above code is printing the html file but the problem is that the
printer
dialog box is displayed every time the page is printed.

More to the point, the above code is running on the webserver, not the
client machine - as soon as you try to run this in a server environment, it
will not work at all...

Where is the printer that you're trying to print to? If it's a network
printer, your best solution would be to write a webservice which sniffed a
database for print jobs.

If it's attached to the client machine that the browser is running on, you
cannot do this natively - you'd need at the very least to write an ActiveX
control and then ramp your security right down just to get it to download
and install, never mind run...
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top