使用c#应用程序打印tiff文件 [英] Printing tiff files using c# application

查看:117
本文介绍了使用c#应用程序打印tiff文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我正在尝试通过我的c#application.in文件列表存储在网络路径中的大量tiff文件显示在datagridview中。通过上下文菜单条我试图打印选定的文件。

以下是我的打印代码...





ProcessStartInfo psi = new ProcessStartInfo();

psi.Arguments =/ P \+ dataGridView1.SelectedRows [0] .Cells [7] .Value.ToString()+ \;

psi.FileName = dataGridView1.SelectedRows [0] .Cells [7] .Value.ToString();

//休息。 psi.Verbs = {打开,打印};

psi.Verb =打印;

Process.Start(psi).WaitForExit();



每当我点击cntxtstrip所选文件在MS-Picture管理器中打开而不是打印..我想将所选的tiff文件直接发送到printter而不显示文件..



请帮我解决这个问题.........

解决方案

开始一个单独的过程几乎总是坏的;做自己的打印要好得多。您可以使用类 System.Drawing.Printing.PrintDocument

http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument%28v= vs.110%29.aspx [ ^ ]。



对于TIFF,你可以创建一个位图(如果你有的话)一个文件,使用构造函数打开它,然后在打印页面方法中使用 Graphics.DrawImage 。请参阅:

http ://msdn.microsoft.com/en-us/library/system.drawing.graphics%28v=vs.110%29.aspx [ ^ ],

< a href =http://msdn.microsoft.com/en-us/library/system.drawing.bitmap%28v=vs.110%29.aspx> http://msdn.microsoft.com/en-us /library/system.drawing.bitmap%28v=vs.110%29.aspx [ ^ ]。



-SA

hello all...
i am trying to print huge amount of tiff files stored in a network path through my c# application.list of files are displayed in datagridview. through context menu strip i am trying to print selected files.
below is my code for printing...


ProcessStartInfo psi = new ProcessStartInfo();
psi.Arguments = "/P \"" + dataGridView1.SelectedRows[0].Cells[7].Value.ToString() + "\"";
psi.FileName = dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
//Break. psi.Verbs = { "Open", "Print" };
psi.Verb = "Print";
Process.Start(psi).WaitForExit();

whenever i click on cntxtstrip the selected file opens up in MS-Picture manager rather than printing.. i want to send the selected tiff files directly to printter without showing the file..

Please help me to solve this issue.........

解决方案

It's almost always bad to start a separate process; it's much better to do your own print. You can use the class System.Drawing.Printing.PrintDocument:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument%28v=vs.110%29.aspx[^].

As to the TIFF, you can create a bitmap (if you have a file, open it using the constructor), and then use Graphics.DrawImage in your print page methods. Please see:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap%28v=vs.110%29.aspx[^].

—SA


这篇关于使用c#应用程序打印tiff文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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