如何从Sharepoint编程方式打印文件 [英] How print a file from sharepoint programatical
本文介绍了如何从Sharepoint编程方式打印文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用c#打印文档库中的pdf文件
为什么当我选择文档并单击打印"后缀按钮以打印此文档时,为什么我有一个带有某些文档名称的lisbox.
how can i print a pdf file that is in a document library using c#
Why becouse i have a lisbox with the name of some docuemnts, when i chosse the document and click a button "print" suppost to print this docuemnt.
推荐答案
您好!
您的基本语法的结构如下:
Hi there!
Your basic syntax would be structured like this:
print [/d:Printer] [Drive:][Path] FileName [ ...]
以下是一些可能适合您的代码段:
Here are a couple of code snippets that might work for you:
Process p = new Process();
p.EnableRaisingEvents = true;
p.StartInfo = new ProcessStartInfo()
{
CreateNoWindow = true,
Verb = "print",
FileName = file,
Arguments = "/d:"+printDialog1.PrinterSettings.PrinterName
};
{
p.Start();
}
或通过控制台应用程序尝试以下操作:
Or try this through a console application:
Process process = new Process();
process.StartInfo.FileName = @"C:\Program Files\Adobe\Acrobat XX\Reader\AcroRdxx.exe";
string strFileName = PDFFileUpload.PostedFile.FileName;
string filename = strFileName;
process.StartInfo.Arguments = "/p /h \"" + filename + "\" \"" + drpPrinter.SelectedIndex + " \""; //"/t " + @"C:\file.doc" // "PRINTER DEV";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
process.CloseMainWindow();
祝你好运!
戴安娜(Diana)
Good luck!
Diana
这篇关于如何从Sharepoint编程方式打印文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文