0
votes

I have virtual printer installed which prints through redirected port and sends document to real printer via gsview\gsprint.exe. It works normally when I use gsprint from a normal C++ application. But if call the same thing through a windows service (run as SYSTEM), it gives following error. It sees the printer but perhaps doesn't have access to it. I am on windows 10 but windows 7 also has the same issue. How can I solve this problem?

2006-02-24 gsprint 1.9 Couldn't open Windows GDI printer driver Requested printer: "SupplyDep"

Available printers: "Send to OneNote 2010" "VirtualPrinter" "SupplyDep" "Microsoft XPS Document Writer" "Fax"

1
I have a feeling that this question is better suited for Super User - Dialecticus
I would, personally, assume that the process when executed from a windows service, does not have user rights to print. A quick perusal of the source indicates that this is likely the result of OpenPriner() returning false or CreateDC() returning NULL.Note that this isn't really intended as some kind of print server, if you want to use it that way you will likely have to modify the source and rebuild it. - KenS

1 Answers

1
votes

I ran into a similar issue trying to run gsprint as the NT Authority/system user. The last post in this link helped a lot. Basically I setup the printer under my user and then I copied the registry entries for the printer to the default user.

Below are the registry keys I copied from HKEY_CURRENT_USER to HKEY_USERS\.DEFAULT

    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices
    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts
    HKEY_CURRENT_USER\Printers

You'll need to restart the Print Spooler service (or just restart the server) in order for the changes to take effect.