我需要将 PDF 文件打印到一些基于硬件的打印机和一些虚拟 PDF 打印机。我正在使用 Ghostscript 来完成这项任务,编程语言是 C#。
硬件打印机在每个文档之后打印一个 PrintJob 页面,其中包含一些信息,例如日期/时间和文档名称。
虚拟打印机打印文档,但名称不同。(Ghostscript 文档)
使用 Ghost 脚本时我无法更改/或设置文档名称,感谢您的帮助。
using (GhostscriptProcessor processor = new GhostscriptProcessor())
{
List<string> switches = new List<string>
{
//"-empty",
"-dPrinted",
"-dBATCH",
"-dNOPAUSE",
"-dNoCancel",
"-dNOSAFER",
"-dNumCopies=1",
"-sDEVICE=mswinpr2",
"-sDocumentName=" + String.Format("\"{0}\"",Path.GetFileName(fileName)),
"-sOutputFile=%printer%" + printerName ,
"-f",
fileName
};
processor.StartProcessing(switches.ToArray(), null);
}
开关 'sDocumentName' 不起作用,我仍然看到使用默认名称打印文档 - “Ghostscript Document”