【问题标题】:Print document in c# console app在 C# 控制台应用程序中打印文档
【发布时间】:2018-08-20 07:58:51
【问题描述】:

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

【问题讨论】:

  • "could not be found in VS" 然后添加对 System.Drawing 的引用。我不知道从长远来看这是否会对您有所帮助,现在开始挖掘。
  • 这对我有用:在解决方案资源管理器选项卡中,右键单击参考并选择“添加参考...”。然后单击 Assemblies、Framework 并向下滚动,直到看到 System.Drawing。单击它旁边的复选框,然后单击确定。但是现在我不知道如何引用要打印的文档?谢谢。
  • 您是想在调用默认应用程序“打印”功能(如在资源管理器中右键单击 - 打印)时让 Windows 打开任何文档,还是您想自己处理文档?

标签: c# console-application printdocument


【解决方案1】:

这对我有用:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 2023-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多