Print button in Asp.Net with C#

Posted by Pand under C# on 2/10/2014 | Points: 10 | Views : 3857 | Status : [Member] | Replies : 3
Hi,

I need to print a .docx/.pdf from the project folder.

I tried with the below code but no luck.

ProcessStartInfo info = new ProcessStartInfo(path);
info.Verb = "Print";
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(info);


Please suggest me how to proceed.

Thanks&Regards,
Pand.




Responses

Posted by: Bandi on: 2/11/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
refer
http://www.c-sharpcorner.com/Blogs/13946/

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Pand, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sravan661 on: 2/11/2014 [Member] Bronze | Points: 25
Posted by: Learningtorise on: 2/11/2014 [Member] Starter | Points: 25

Up
0
Down
This is NOT possible using code behind (ASP.NET). ASP.NET is running on the server, it isn't aware of any printers attached to your local computer.

if you want to print it on the client's pc then you need to go for javascript (window.print()). If the page needs to be printed on the server (printer attached to your server or via network it's known) then you can make use of the .NET functionality for printing.

ASP.NET does not offer such functionality so you'll need to create your own solution or go for a third party one. One approach could be you export all your docs (xls, doc, etc) to PDF in code-behind and then let the user to print the output PDF locally. But if you want to automate the printing process then this tool will help you with that task.
http://www.neodynamic.com/products/printing/raw-data/aspnet-mvc/


http://hashtagakash.wordpress.com/

Pand, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response