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! þÿÿÿ8­w4­w 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.


In reply to printing to a local printer from IIS 7.5 and server 2008 r2 by blenkhn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.