5

I have program that sends a file to a printer using 'lpr' command. I have installed Windows SDK 7.1. It is working fine in a 32 bit Windows 7 system but not working in 64 bit Windows 7.

            Process proc = new Process();
            proc.StartInfo.FileName = "lpr";
            proc.StartInfo.WorkingDirectory = GlobalConstants.outBaseDir;
            proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            proc.StartInfo.Arguments = " -S " + GlobalConstants.printerIP + " -P RAW " + filePath;
            proc.Start();

It throws an execption.

Sundeep
  • 2,035
  • 2
  • 23
  • 38

1 Answers1

11

I finally got the answer to my question.

Step1: I had to enable "LPR Port Monitor". This can be done through "Control Panel/Programs and Features/Turn Windows features on or off". In the dialog expand "Print and Document Services." Check "LPR Port Monitor."

Step2: When you install Windows SDK 7.1. It will copy lpr.exe and related files into "C:\Windows\winsxs\amd64_microsoft-windows-p..ting-lprportmonitor_xxxx...". Copy the files lpr.exe, lprhelp.dll, and lprmonui.dll into the C:\Windows\sysWOW64 folder.

Thats it!!!

Reference: http://www.tomshardware.com/forum/240019-44-error-windows

Sundeep
  • 2,035
  • 2
  • 23
  • 38
  • Great answer I was stuck on this for a while with a web server running Server 2008 R2. Copied all lpr... files from: C:\Windows\System32 to C:\Windows\SysWOW64 and my app successfully loaded lpr.exe! – Baxter Aug 26 '14 at 17:01