Jigsaw Blog

12

Nov
2012
0 comments

Settings to access printer are not valid

We were trying to print from a dotnet assembly. This assembly was being used by a webserver/service running on Windows 2008R2.
Tried applying the registry hack described in http://support.microsoft.com/kb/184291/en-us But was still receiving the error

Settings to access printer "printer name" are not valid

Tried writing to a log file the printers available to the impersonated user. The printer shown in the error message is listed in the log as available.

The fix is to wrap the call to the printing in the statement

using (System.Security.Principal.WindowsImpersonationContext wic = System.Security.Principal.WindowsIdentity.Impersonate(IntPtr.Zero))

{

}