2

I have a dye sub printer, and I'm trying to send an image to print programatically.
I'm using PrintDocument and a PrintPage with C# 4.0 on Windows 7 64b.
Printing fails, and windows gives this error:

The print spooler failed to load a plug-in module 
C:\Windows\system32\spool\DRIVERS\x64\3\S6145UI.DLL, error code 0xc1

The printer works fine with Window's default Print dialog.
The code works fine when printing with a regular laser printer.
I'm completely stumped.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Shachar Weis
  • 936
  • 2
  • 20
  • 44

1 Answers1

1

error code 0xc1

That's ERROR_BAD_EXE_FORMAT. Not an uncommon error on the 64-bit version of Windows but rather a major fail whale for a printer driver. You'll get this error when a 64-bit process tries to load a 32-bit DLL. Or the other way around.

Clearly the driver is at fault here, you should look for an update. A possible workaround is to force your program to run in another mode, easy to do for a managed program. Right-click your EXE project, Properties, Build tab. Change the Platform target setting, flipping between AnyCPU vs x86. On VS2012 toggle the Prefer 32-bit mode checkbox. Not actually so sure this will work, the spooler is its own subsystem. I think there's a way to force the spooler to run in 32-bit mode for legacy printer drivers, ask about it at superuser.com

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536