错误在C#,asp.net 3.5中没有使用打印对话框的情况下打印文件 [英] error Printing files without using print dialog box in C#, asp.net 3.5

查看:106
本文介绍了错误在C#,asp.net 3.5中没有使用打印对话框的情况下打印文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在做一个项目(在线打印管理系统).我们将网络打印机用于
打印文件,但是当我们给出以下代码来打印文件时.

打印文档无法从系统获取文件.


I am working on a project(online printing management system). By which we use network printer for
printing files but when we gives following code for printing file.

print document does not get the file from the system.

if (printersList.Items.Count > 0)
   {
   pr = new PrintDocument();
   pr.PrinterSettings  = new PrinterSettings();
   pr.PrinterSettings.PrinterName = printersList.SelectedItem.ToString();
   pr.PrinterSettings.Copies = Convert.ToInt16(txtNoOfCopies.Text);
   //if (File.Exists(filename ))
       //{
       pr.PrinterSettings.PrintFileName = FileUpload1.FileName;
       // pr.PrinterSettings.PrintFileName = filename;
       pr.Print();
       //}
   }


打印机获取命令,但打印空白页.

高亮行中的printersetting中没有获取文件名.
请尽可能提出正确的解决方案.

[edit]用于格式化的代码块-OriginalGriff [/edit]


printer gets the command but print blank pages.

in highlited line printersetting does not get the file name.
plz suggest the right solution if possible.

[edit]Code block for formatting - OriginalGriff[/edit]

推荐答案

您的服务器上不存在文件名.您需要保存文件字节,然后从那里打印.显然,这仅在LAN上有效,因为它是服务器进行打印.
The filename does not exist on your server. You need to save the file bytes and then print from there. Obviously this will only work on a LAN because it''s the server doing the printing.


这篇关于错误在C#,asp.net 3.5中没有使用打印对话框的情况下打印文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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