Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Printing simple graphics

by Dinosaur (Beadle)
on Mar 21, 2001 at 01:34 UTC ( [id://65828]=perlquestion: print w/replies, xml ) Need Help??

Dinosaur has asked for the wisdom of the Perl Monks concerning the following question:

I want to print a calendar page. Initially just a 7x5 grid of boxes with dates and a simple "March 2001" page header, then I'll add schedule notes etc. But I'd like it to look reasonably professional, which means real graphics rather than faking it with characters.

I want to send the output straight to a printer. I'd like to do this under both *nix and MSWindows.

The O'Reilly "Programming Web Graphics with Perl" book suggests generating postscript. They recommend a module (whose name I forget, don't have the book handy). For my purposes I could just as easily crank out the PS directly.

But how do I print that? My Epson 740 is not a native PS speaker (right?), so when I send it PS language, it happily prints the PS source. I'd need Ghostscript, I guess? I gather that will let me create a "virtual" PS printer. Can I speak directly to Ghostscript from perl, hand it a scalar full of PS source and say, "Here, print this"?

Or I could go the graphics route, and create a .gif (.png?) file. Again, how do I print that directly from perl?

Or is there a simpler way?

Your insights are solicited.

Replies are listed 'Best First'.
Re: Printing simple graphics
by arturo (Vicar) on Mar 21, 2001 at 02:02 UTC

    I don't know much about postscripting in Perl, but here is what you get when you search on "postscript" on CPAN. If you want to generate your calendar as a graphic, I'd suggest one of the modules you'd find under GD.

    To print PS to a non-PS printer, yes you will need ghostscript, but that will get handled transparently under most Linux distributions these days (your printer filter will be set up to make it transparent).

    HTH

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      Just a small addition: ghostscript is supported on both windows and linux, so that shouldn't be a problem. Ghostscript does not print .gif files (because of the unisys-patent issue), but neither does GD generate .gif files...

      hth

      Jouke Visser, Perl 'Adept'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found