使用C#在Asp.Net中打印按钮 [英] Print button in Asp.Net with C#

查看:83
本文介绍了使用C#在Asp.Net中打印按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要从项目文件夹中打印.docx / .pdf。



我试过下面的代码,但没有运气。



ProcessStartInfo info = new ProcessStartInfo(path);

info.Verb =打印;

info.CreateNoWindow = true;

info.WindowStyle = ProcessWindowStyle.Hidden;

Process.Start (info);




请建议我继续操作。



谢谢和问候,

Pand。

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.

推荐答案

推荐这些链接



link1

link2

< a href =http://www.c-sharpcorner.com/uploadfile/rahul4_saxena/printing-in-Asp-Net/> link3


您正在编码ASP.NET网站意味着您的代码将在服务器端而不是在客户端计算机上运行。我想你想把文件打印到客户端打印机,对吧?如果是这样,那么您在那里的代码将无法再次运行,它将在您将托管您的站点的服务器机器上执行。如果要打印PDF,doc等文件;那么您可以执行以下操作之一:#1只需让用户打开文件并让他/她手动打印它; #2您可以使用 Google Doc Viewer 在您的网页中显示该文件使用window.print()javascript代码打印iframe内容;或#3还有其他工具可以实现这一点,如这个,但它不是免费的,可悲的是。
You are coding an ASP.NET website which means that your code will run at server side not at the client machine. I guess that you want to print the file to the client printer, right? If so, then that code you have there will not work as again, it'll be executed at the server machine where you'll host your site. If you want to print a file like PDF, doc, etc; then you could do one of the following: #1 Just let the user to open the file and let him/her to print it "manually"; #2 You could display the file in your web page using Google Doc Viewer then print that iframe content by using window.print() javascript code; or #3 there are other tools that can make this happen like this but it's not free, sadly.


这篇关于使用C#在Asp.Net中打印按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆