Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Printing document to LAN

Hi guys,

I've got some documents (typically PDF files that I've created) that I need to be able to print to network print queues from within my ASP.NET code.

I did some Googling and found the ProcessStartInfo class which looks like I can print to the default printer, but I don't think it'll allow me to send it to a LAN printer.

I have a web-app (Intranet-only) which generates the PDF documents for the User and I'd like to be able to print them out to the User's local printer.

Any help would be appreciated.

Thanks,

SMJ.

SMJ
Friday, May 20, 2005

Good luck - you're gonna need it.

Here's what I found out.  You can print using the System.Drawing.Printing classes on a server under some conditions, but apparently as soon as you access the server with a URL that contains a period, it'll stop working.

i.e:
http://localhost/app/page - can print
http://servername/app/page - can print
http://servername.domain.com/app/page - can't print
http://192.168.1.100/app/page - can't print

You'll get an exception in the last 2 cases. 

Of course, you can just download the pdf to the end-user, and let them print it.

Chris F
Friday, May 20, 2005

Chris F - "Of course, you can just download the pdf to the end-user, and let them print it."

Yeah, that was going to be my fallback position, but it isn't as flexible as I'd like.

SMJ
Friday, May 20, 2005

What do you need to do that you can't do with a PDF?

One other work-around is to print directly to the printer - that assumes a network-connected printer.  In my case, all the printers are on the intranet, and they're all HP, so as long as I can send PCL down the wire, it works.  Ugly though.

Chris F
Friday, May 20, 2005

Chris,

You are right of course, I can just let them print from the PDF, but I wanted it to be a one-click operation to generate the document and send it to the User's local printer.

I know it is only one more click, but it just doesn't seem right.

Thanks for the feedback though. I think in the absence of any other solution, I will do just that.

SMJ
Monday, May 23, 2005

*  Recent Topics

*  Fog Creek Home