0

我有下面的代码。据我所知,它正在转换并保存为 pdf。谁能解释这段代码?

Process cnp = new Process();
cnp.StartInfo.FileName = "AcroRd64.exe";
cnp.StartInfo.Arguments = "/n /t c:/test.jpg Microsoft Office Document Image   Writer";

更新:

我创建了一个示例控制台应用程序来触发打印,但它不工作

class Program
{
    static void Main(string[] args)
    {
        try
        {
            Process p = new Process();

            p.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe";
            p.StartInfo.Verb = "Print";
            p.StartInfo.Arguments = "/n /t c:/test.png " + "Microsoft Office Document Image Writer";
            p.StartInfo.CreateNoWindow = false;
            p.StartInfo.UseShellExecute = true;
            p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
        Console.ReadKey();
    }
}
4

1 回答 1

0

进程用于启动和停止系统上的进程。

似乎很清楚您的代码试图启动一个进程“AcroRd64.exe”,我猜它是 pdf-reader Adob​​e Acrobat Reader。Argumens是进程的参数,所以基本上,这相当于在命令行中编写以下内容:

AcroRd64.exe /n /t c:/test.jpg Microsoft Office Document Image   Writer

在 this other SO question下有更多关于此的信息。

您的代码可能不起作用,因为单个参数Microsoft Office Document Image Writer包含空格。尝试:

 cnp.StartInfo.Arguments = 
     "AcroRd64.exe /n /t c:/test.jpg \"Microsoft Office Document Image Writer\"";
于 2015-01-29T07:05:09.337 回答