Generating report PDF exception ---> System.Printing.PrintQueueException: PrintTicket provider failed to bind to printer. Win32 error: -2147467231
at MS.Internal.Printing.Configuration.PTProvider..ctor(String deviceName, Int32 maxVersion, Int32 clientVersion)
at MS.Internal.Printing.Configuration.PTProviderBase.Create(String deviceName, Int32 maxVersion, Int32 clientVersion)
at System.Printing.PrintTicketManager..ctor(String deviceName, Int32 clientPrintSchemaVersion)
at System.Printing.PrintQueue.get_DefaultPrintTicket()
... call from my service application ...
c# code for the print job:
Code: Select all
var printServer = new LocalPrintServer();
PrintQueue queue = printServer.GetPrintQueue("novaPDF");
PrintTicket pt = queue.DefaultPrintTicket.Clone();
pt.PageMediaSize = new PageMediaSize(PageMediaSizeName.ISOA4); // set size of media (paper)
XpsDocumentWriter docWriter = PrintQueue.CreateXpsDocumentWriter(queue);
// set size of printable area
copyOfDocument.PageSize = PageSize;
docWriter.Write(copyOfDocument, pt);
OS: Windows 8 Pro 64-bit (6.2, Build 9200)
I'm wondering if it is something regarding rights to print on a printer from a service ... and I can't find cause of this error. Please do you know how to solve this problem?
--edit--
I have tried to modify service properties to start as a local user and I also tried to grant all the rights on the novaPDF printer to the local users. Exception still remains.