【发布时间】:2020-05-27 15:25:36
【问题描述】:
在我的 C# winform 应用程序中,我使用 Adobe Reader DC 静默打印 pdf 文件。 pdf 文件应以彩色打印,但打印机设置的打印首选项为黑白。如何更改此属性并以编程方式将其设置为颜色。 这是我的静默打印代码:
public void StartPrinting(string fullFilePathForPrintProcess, string printerName)
{
string printApplicationPath = FindAdobeAcrobatPath();
const string flagNoSplashScreen = "/s";
const string flagOpenMinimized = "/h";
var flagPrintFileToPrinter = string.Format("/t \"{0}\" \"{1}\"", fullFilePathForPrintProcess, printerName);
var args = string.Format("{0} {1} {2}", flagNoSplashScreen, flagOpenMinimized, flagPrintFileToPrinter);
var startInfo = new ProcessStartInfo
{
FileName = printApplicationPath,
Arguments = args,
CreateNoWindow = true,
ErrorDialog = false,
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden
};
var process = Process.Start(startInfo);
// Close Acrobat regardless of version
if (process != null)
{
process.WaitForInputIdle();
process.CloseMainWindow();
process.Dispose();
}
}
感谢任何帮助。
【问题讨论】:
-
“...Adobe Reader 的打印机属性始终设置为黑白”是什么意思?
-
@Formula12 抱歉解释不好,我有彩色 pdf 文档,我使用 Adobe Reader 打印它。但在打印机设置中,打印首选项设置为黑白。所以输出是黑白的。在网上进行了更多搜索后,我发现我需要通过我的 C# 代码更改打印首选项,但我仍然不知道如何。我非常感谢您的帮助。
标签: c# winforms pdf printing colors