Printing in client side directly-without prompting for a print dialogue

Topics: ASP.NET Web Pages
Jul 26, 2012 at 4:11 AM

dear all,
I am making a Web Part for a sharepoint site with .NET (visual studio 2010).

How can I add a button in my web part, clicking on which will print a .text file stored on my server's c: drive to a printer on the client side without prompting for a 'print' dialogue box?

The file to be printed is in the server's c: drive where the sharepoint site is hosted.
The printer will be a local printer attached to the client machine.

I have used the code at for creating the .text file.

Please suggest.
Thanks in advance.

Jul 26, 2012 at 4:35 PM


This is not possible due to security reasons. A web site cannot force anything to ever be printed on a client computer.

BTW this forum is specifically for ASP.NET Web Pages with Razor Syntax. For SharePoint questions I recommend asking on or searching through their existing questions & answers:



Jul 28, 2012 at 4:28 AM

Dear all,

Finally, I have solved the problem.

Made a .dll filr from the link

Added the dll to the GAC.

Call it in my code.....and voila.......It prints my text file.

Note that I am using a HP Laserjet P2015 PCL6.

......Thanks to all for your valuable guidance.