我参考了这段代码片段(http://stackoverflow.com/questions/2599925/how-to-print-pdf-on-default-network-printer-using-ghostscript-gswin32c-exe-she)很好。我可以从我的wcf服务中静默打印文件。
但是如果我通过IIS运行它会遇到问题。 意思是“http:// localhost:5030 / mywcf”完美地工作。 如果我将其更改为“http://172.16.16.1/mywcf”,则面临以下错误。这是堆栈跟踪。
----------------------------------------------------- [06-18-12 03:38:48] GetSignoff(): The handle is invalid : at System.Diagnostics.Process.CreatePipeWithSecurityAttributes(SafeFileHandle& hReadPipe, SafeFileHandle& hWritePipe, SECURITY_ATTRIBUTES lpPipeAttributes, Int32 nSize) at System.Diagnostics.Process.CreatePipe(SafeFileHandle& parentHandle, SafeFileHandle& childHandle, Boolean parentInputs) at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at XX.XX.PrintPDF.PrintVSPDF(String ghostScriptPath, Int32 numberOfCopies, String printerName, String pdfFileName) in D:\XX\Code\Server_MU\eBusiness\Business\PrintPDF.cs:line 551 at XX.Business.PrintPDF.Print(String patientId, String reportName, String loginId, String mailMessageId, String deviceId, String facilityId, String noteId) in D:\XX\Code\Server_MU\XX\Business\PrintPDF.cs:line 498 -------
然后我尝试执行通过cmd.exe生成的相同命令,该工作正常。任何暗示都可能有所帮助。
提前感谢。
RGDS, pa'1'
答案 0 :(得分:0)
html or pdf printing on server side c#
此致 Pavan N