This is new software running in a Windows Service as a domain user. The service downloads a PDF file, and then attempts to print the document. This is logged by the service:
09:57:20.246 - 226 Transfer complete. Data Connection Closed. 09:57:20.246 (ClosingData) 09:57:20.246 PrintQueueServiceThread signalled 09:57:20.356 Printing 4 pages of C:\Users\Lee\AppData\Local\Temp\PQ_A000641683.pdf to LZC1 - Programmer Area on ADC02.ODP.COM (redirected 5)... 09:57:20.590 pdftron.Common.PDFNetException: Exception: Message: Could not start XPS print job Conditional expression: SUCCEEDED(hr) Filename : PDFPrintDocSpoolerWin.cpp Function : trn::PDF::Print::PDFPrintDocSpoolerWin::StartXpsPrintJob Linenumber : 808
09:57:20.590 at pdftron.PDF.Print.StartPrintJob(PDFDoc in_pdfdoc, String in_printerName, String in_jobName, String in_outputFileName, PageSet in_pagesToPrint, PrinterMode in_printerMode, Context in_ctx) 09:57:20.590 at EljayRelay.Globals.PrintQueueServiceThread() in D:\ODPNET40\Customer\Eljay\EljayRelay\Globals.vb:line 1111
Any hints you can offer as to what I’m doing wrong and the cause of the exception will help me greatly. It can be a challenge to debug services sometimes, and I really depend on the error diagnostic logs for debugging.
If this helps…
If Not String.IsNullOrEmpty(thisPrintFile) Then
Dim doc As PDF.PDFDoc = Nothing
Try doc = New PDF.PDFDoc(thisPrintFile) doc.InitSecurityHandler() ODP_DOCUMENTS_PRINTER = GetSetting("ElayRelay", "ServiceConfiguration", "ODP_DOCUMENTS_PRINTER", "") PLog(vbTab & "Printing " & doc.GetPageCount.ToString & " pages of " & thisPrintFile & " to " & ODP_DOCUMENTS_PRINTER & "...") pdftron.PDF.Print.StartPrintJob(doc, ODP_DOCUMENTS_PRINTER, doc.GetFileName, "", New PDF.PageSet(1, doc.GetPageCount), New PDF.PrinterMode(), Nothing) Catch ex As Exception PLog(ex.ToString) End Try
Try If doc IsNot Nothing Then doc.Close() doc.Dispose() doc = Nothing End If Catch ex As Exception
I was remoting in to the computer where the service runs. The printer I had selected was “redirected”, which I did not quite understand. Apparently these are from my remote source logon session. This is valid for the remote session, but not as it uses my logon in the Windows service. I actually installed the printer I wanted at the computer where the service runs, and configured for it, and it all works perfectly now. Can’t blame PDFNET… you gotta have a printer installed if you want it to print something for you.
I was able to resolve this issue a couple of months back within our network by understanding that this diagnostic was caused by the printer not existing for the credential our Windows Service was using. We are just now getting around to installing this at the customer's site. I had to configure our service to use a printer that was defined to the credentials the Windows Service runs under, rather than be a proxy printer created via coming in via REMOTE DESKTOP. That was before. I have a new issue now...
Back at the customer's site now, but still it is not working. We see our service logging this:
02:17:12.682 at pdftron.PDF.Print.StartPrintJob(PDFDoc in_pdfdoc, String in_printerName, String in_jobName, String in_outputFileName, PageSet in_pagesToPrint, PrinterMode in_printerMode, Context in_ctx)
02:17:12.682 at EljayRelay.Globals.PrintQueueServiceThread()
02:17:12.697 Printing 2 pages of C:\Users\Jeff\AppData\Local\Temp\PQ_Inv0809788_20171106.pdf to \\CARLI-PC\HP LaserJet 4050 Series PCL 5...
02:17:12.900 pdftron.Common.PDFNetException: Exception:
Message: *Could not start XPS print job*
Conditional expression: SUCCEEDED(hr)
Filename : PDFPrintDocSpoolerWin.cpp
Function : trn::PDF::Print::PDFPrintDocSpoolerWin::StartXpsPrintJob
Linenumber : 808
So it did not print. I see it "could not start XPS print job". But why, is what we really need to know.
What happens in PDFPrintDocSpoolerWin.cpp at line number 808? Is the cause for the "could not start" available to me by any means anywhere?