0
votes

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. i can able to print a file silently from my wcf service.

But am getting a problem if i run this via IIS. means "http://localhost:5030/mywcf" work perfectly. if i change it to "http://172.16.16.1/mywcf" then am facing the following error. 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. any hint might be helpful.

thanks in advance.

rgds, pa'1'

1

1 Answers

0
votes

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#

Regards, Pavan N