简体   繁体   English

通过IIS使用ghostscript打印pdf

[英]printing pdf using ghostscript via IIS

I referred this code snippet (http://stackoverflow.com/questions/2599925/how-to-print-pdf-on-default-network-printer-using-ghostscript-gswin32c-exe-she) and it worked very well. 我引用了此代码段(http://stackoverflow.com/questions/2599925/how-to-print-pdf-on-default-network-printer-using-ghostscript-gswin32c-exe-she),并且效果很好。 i can able to print a file silently from my wcf service. 我可以从wcf服务中静默打印文件。

But am getting a problem if i run this via IIS. 但是如果我通过IIS运行它,则会遇到问题。 means "http://localhost:5030/mywcf" work perfectly. 表示“ http:// localhost:5030 / mywcf”可以正常工作。 if i change it to "http://172.16.16.1/mywcf" then am facing the following error. 如果我将其更改为“ http://172.16.16.1/mywcf”,则面临以下错误。 here is the stack trace. 这是堆栈跟踪。

-----------------------------------------------------

[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
-------

and then i tried to execute the same command generated via cmd.exe which is working fine. 然后我尝试执行通过cmd.exe生成的相同命令,效果很好。 any hint might be helpful. 任何提示可能会有所帮助。

thanks in advance. 提前致谢。

rgds, pa'1' rgds,pa'1'

for this i got an work around. 为此,我得到了解决。 the post i did here for the different logic. 我在这里为不同的逻辑做的帖子。 holds goood for this requirement also. 对此要求也很严格。

html or pdf printing on server side c# 在服务器端C#上进行html或pdf打印

Regards, Pavan N 此致,Pavan N

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM