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

Topics: ASP.NET Web Pages
Jul 26, 2012 at 5: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 http://www.dotnetspider.com/resources/43366-Printing-Datatable-Data-In-C.aspx for creating the .text file.


Please suggest.
Thanks in advance.

Coordinator
Jul 26, 2012 at 5:35 PM

Hi,

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 StackOverflow.com or searching through their existing questions & answers: http://stackoverflow.com/questions/tagged/sharepoint

Thanks,

Eilon

Jul 28, 2012 at 5:28 AM

Dear all,

Finally, I have solved the problem.

Made a .dll filr from the link http://stackoverflow.com/questions/3507187/how-to-print-a-pcl-file-in-c.

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.