How to print a flat file in ASP.NET 2.0

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to print a flat file or send printer controls to a specified printer
or port (lpt1,lpt2, com1...) in a web page.
Is it possible? How?
 
It's a client-side task and you do it with a javascript call

window.print()

It will open the browser's Print dialog. There is no way how you can bypass
the dialog and select printer programmatically unless you employ an ActiveX
control.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
Ok, thanks. I think i needd an activex.
--
JLobo


Eliyahu Goldin said:
It's a client-side task and you do it with a javascript call

window.print()

It will open the browser's Print dialog. There is no way how you can bypass
the dialog and select printer programmatically unless you employ an ActiveX
control.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


JLobo said:
I need to print a flat file or send printer controls to a specified printer
or port (lpt1,lpt2, com1...) in a web page.
Is it possible? How?
 
Ok, thanks. I think i need an activex.

Think *very* carefully before you go down that route, though...

1) ActiveX controls only work in IE

2) You will need to seriously ramp down browser security just to get them to
work at all

3) If you manage to find a 3rd-party control, make absolutely sure it's from
a reputable and reliable source - you're going to have to lower browser
security down so far that this ActiveX control is allowed to talk directly
to the local machine's hardware...

I would seriously advise you to try to find an alternative solution if at
all possible...
 
window.print(), as mentioned, will work client side. It will not target a
particular printer, however. The user will have to do that.

If you need to target a printer, and this is an intranet, you can create a
"print" button that is keyed, server side, to a particular printer. It would
not print from the client side, but would solve your problem. For an
Enterprise, you would have to map users to printers, but it could be done.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
Back
Top