Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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 line 4 ". Detailed Error Information Module CgiModule Notification ExecuteRequestHandler Handler perl script map Error Code 0x00000009 Requested URL Physical Path 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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1024440]
Approved by kcott
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2018-06-21 14:37 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.