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

Printing GIF/PNG in the middle of a text report

by jwills (Novice)
on May 30, 2002 at 18:34 UTC ( [id://170470]=perlquestion: print w/replies, xml ) Need Help??

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

I need to print a report from a database. The report will be several lines of text (at various positions on the page) and then 1 or more barcode images which will be stored in a GIF or a PNG format. After the barcodes are printed then there will need to be several more lines of text. The environment is a unix and the printer is a HP printer.

How can this be done? How would I print the image where I need it and then print more text?

Any help would be greatly appreciated.

Jeff Willsea
jwills@woodward.com
  • Comment on Printing GIF/PNG in the middle of a text report

Replies are listed 'Best First'.
Re: Printing GIF/PNG in the middle of a text report
by FoxtrotUniform (Prior) on May 30, 2002 at 18:48 UTC

    I'd suggest extracting the data from the DB, writing it to an intermediate format (TeX or LaTeX would be very much appropriate, I think), then printing the generated document in the usual way.

    If you want to do PDF, Text::PDF looks useful.

    --
    The hell with paco, vote for Erudil!
    :wq

Re: Printing GIF/PNG to a HP printer
by Abigail-II (Bishop) on May 30, 2002 at 16:44 UTC
    There isn't much Perl about this question.

    Most printers know by default how to print plain text, PostScript, and perhaps some proprietary format. Not that it really matters for a user what a printer can print, as all the translation is done by the print server. So, you either have to configure the print server to filter PNG images into a format the printer understands, or you have to translate your PNG image to a format your printer server knows how to handle.

    And that's about all there can be said about it. How to configure a print server varies wildly from system to system. Your best resource would be to talk to your system adminstrator. Bring beer. Offer sushi.

    Abigail

Re: Printing GIF/PNG in the middle of a text report
by Matts (Deacon) on May 30, 2002 at 18:45 UTC
    Why not create LaTeX from perl and then print it via latex commands?
Re: Printing GIF/PNG in the middle of a text report
by tomhukins (Curate) on May 30, 2002 at 19:05 UTC
    In addition to others' comments, you might find GD::Barcode useful for creating the barcode images.
Re: Printing GIF/PNG in the middle of a text report
by particle (Vicar) on May 30, 2002 at 19:30 UTC
Re: Printing GIF/PNG to a HP printer
by termix (Beadle) on May 30, 2002 at 18:23 UTC

    As other users have pointed out this is not really a Perl issue. If you have a Perl script that creates the text and pictures, then you will need to:

    • Arrange the graphics within the text so that things print correctly. You could do this by outputing HTML from your Perl script (which has data + formatting). There are modules which would help you do that (you can even use just the printing functions from the CGI module).
    • Then you have to convert it to a printer friendly format. Use a system utility to convert from HTML to postscript. (you can try to see if netscape will print it out in the background for you through command line parameters).
    • Send it to the printer. If it is an HP printer, then it can deal with postscript. If it is connected through jet-Direct then you need to setup a remote printer (a breeze to do if you read man printcap or if you have some friendly linux distribution installed.

    It should not prove a daunting task, but it lies somewhat outside the Perl domain (and I don't recommend writing a Perl driver for your HP).

    -- termix

Log In?
Username:
Password:

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

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

    No recent polls found