Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

printing to a local printer from IIS 7.5 and server 2008 r2

by blenkhn (Acolyte)
on Mar 20, 2013 at 05:15 UTC ( #1024440=perlquestion: print w/ replies, xml ) Need Help??
blenkhn has asked for the wisdom of the Perl Monks concerning the following question:

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 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( 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.

Comment on printing to a local printer from IIS 7.5 and server 2008 r2
Select or Download Code
Re: printing to a local printer from IIS 7.5 and server 2008 r2 (HTTP)
by Anonymous Monk on Mar 20, 2013 at 07:52 UTC
      Thanks very much for your reply. I had to take that out to get at the real error. It would display what I needed but not print anything.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1024440]
Approved by kcott
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-12-25 18:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (161 votes), past polls