I have built a private intranet using perl and have upgrading the site to IIS 7.5 on Windows Server 2008 R2. I have a section that prints tags formatted with win32 Printer. I have gone through all the steps to get perl to work.
I was able to get this working with Server 2003. I basically had to create a user for perl to use in the group IIS_WPG so that perl would print to a local printer. I can print to the printer using a test script called from the command prompt but called from a browser you get this
HTTP Error 502.2 - Bad Gateway
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "ERROR: Cannot create printer object! þÿÿÿ8w4w at testprinter.pl line 4 ". Detailed Error Information
Module CgiModule
Notification ExecuteRequestHandler
Handler perl script map
Error Code 0x00000009
Requested URL testprinter.pl
Physical Path testprinter.pl
Logon Method Anonymous
Logon User Anonymous
The test script that I am using is
#!perl
use Win32::Printer;
my $dc = new Win32::Printer(
printer => 'emtags',
height => 214,
width => 288,
printer => 'emtags',
unit => 'pt'
);
my $font = $dc->Font('Arial Bold', 24);
$dc->Font($font);
$dc->Color(0, 0, 255);
$dc->Write("Hello, Mars!", 50, 50);
$dc->End();
$dc->Close();
exit 0;
Thanks very much for your help with this.