C# 使用.Net打印文件
我正在尝试使用以下代码通过.NET打印 打印机对话框窗口打开,打印作业在队列中,但是没有打印任何内容。。。我可以用其他方式打印。请参见此处的C# 使用.Net打印文件,c#,.net,C#,.net,我正在尝试使用以下代码通过.NET打印 打印机对话框窗口打开,打印作业在队列中,但是没有打印任何内容。。。我可以用其他方式打印。请参见此处的print()扩展方法: OpenFileDialog ofd = new OpenFileDialog(); if( DialogResult.OK == ofd.ShowDialog(this) ) { // Allow the user to select a printer. PrintDialog pd = new PrintD
print()
扩展方法:
OpenFileDialog ofd = new OpenFileDialog();
if( DialogResult.OK == ofd.ShowDialog(this) )
{
// Allow the user to select a printer.
PrintDialog pd = new PrintDialog();
pd.PrinterSettings = new PrinterSettings();
if( DialogResult.OK == pd.ShowDialog(this) )
{
// Print the file to the printer.
RawPrinterHelper.SendFileToPrinter(pd.PrinterSettings.PrinterName, ofd.FileName);
}
}