Still not 100% sure what you're asking here. With CGI, Perl is a server-side scripting language. A button on your web page, if posting to a CGI script, would execute the Perl script on the server, which is the only place Perl can initiate a print function. So if this is the route you can go, a user hitting a web page and clicking on a Print button would post a form to your CGI script, and your CGI script would presumably print something on the server, not the client's printer.

If you're wanting to put a button on an HTML page that prints the current page in the client's printer (as if the user clicked on File | Print in their browser), you can't do this with Perl. Consider JavaScript or some ActiveX/Java component that would communicate with the browser and initiate a print command that way. Perl can't directly interact with a browser. All it does in a CGI context is return content to the browser, typically in the form of an HTML page.

If I'm misunderstanding, by all means elaborate.


In reply to RE: Re: Print to a printer by Fastolfe
in thread Print to a printer by Anonymous Monk

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.