在 C# 控制台应用程序中打印文档

Print document in c# console app

我需要在控制台应用程序中打印任何文档类型,我试过了 使用 System.Drawing.Printing,但在 VS 中找不到。 System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();

这对我有用:

    ProcessStartInfo info = new ProcessStartInfo(filePath);
    info.Verb = "Print";
    info.CreateNoWindow = true;
    info.WindowStyle = ProcessWindowStyle.Hidden;
    Process.Start(info);