Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Paper Reports with PDF or...?

by mandog (Curate)
on Apr 16, 2003 at 04:48 UTC ( #250784=perlquestion: print w/replies, xml ) Need Help??

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

Has anyone experience to share with PDF::Template or PDF::Report?

Has anybody gotten printed mailing labels from a browser with HTML and CSS?

We want to print Avery laminated name badges #05362 from a web browser. The name badge needs a barcode, some text and a picture of a person.

It is important that we print where we are supposed to and waste a minimum of name badges at $1 each. We can specify that a particular browser be used. Ideally we'd like this done relatively quickly

Some possibilities are:

An ASCII dump that can be copied and pasted into an MS Mail Merge or the like. This would be pretty kludgy as the users would have to copy and paste pictures into MS word tables by hand.

PDF::Create This module is recommended a few times on this site, but it doesn't support pictures and there are complaints that it is no longer supported

Cascading Style Sheets & HTML::Template Since CSS allows elements to be placed with precision of 1/72 of an inch and we can restrict the user to one browser, this seems doable...

Latex has some strong supporters. However it looks like it might take longer to learn than other solutions. It might require a bunch of  system("latex_thing -f")calls

PDF::Template A lot like HTML::Template, allows more separation between interface and code. Doesn't support any but the core PDF fonts on LINUX, but we can make the barcode a image with something like this snippit from Mr. Muskrat

PDF::Report seems a little simpler than PDF::Template, but adding a (barcode) font is not obvious from the docs. Presentation and application logic are mixed. Based on the well received PDF::API2 module

Other solutions like RTF::Document and pdf on the fly don't handle people's pictures in a way that is obviousl to me.

These nodes:

...have some helpful info but nothing on PDF::Report and PDF::Template

Barring new info from y'all, we're probably going play simulataniously with HTML/CSS, PDF::Template and PDF::Report until a winner emerges

email: mandog

Replies are listed 'Best First'.
Re: Paper Reports with PDF or...?
by Popcorn Dave (Abbot) on Apr 16, 2003 at 05:44 UTC
    I have used PDF::Labels and PDF::Create to do mailing labels on Avery pre-cut labels, but I didn't do pictures on mine.

    The one thing I can tell you that drove me absolutely crazy, until vroom pointed it out to me, was that you need to turn off print to fit. See this thread.

    My problem was that the first 5 rows would print okay but they'd be creeping up the page and by the end of the page they were spanning into the prior label.

    Hopefully that will keep you from that headache. Good luck!

    There is no emoticon for what I'm feeling now.

Re: Paper Reports with PDF or...?
by revdiablo (Prior) on Apr 16, 2003 at 06:23 UTC

    Popcorn Dave's reply is spot on. Generating PDFs is probably the way to go, as you should truly get reliably precise placement of things.

    I would, however, like to note that I've gone down the HTML/CSS route to generate name badges before... and believe me, it's not a lot of fun. Maybe I was doing something wrong (*ahem* probably: I was using IE at the time, and my CSS skills weren't as well-honed as they are now), but every time I changed anything a minute amount, slight recalibration was necessary. Different printer, different settings. Different logo, different settings. Different text, different settings. You get the idea.

    One thing I'd highly recommend if you go down this path, is *take very detailed notes*... because invariably, next year they're going to want you to print the badges again. At the last minute. With 2x as many badges this year. :)

Re: Paper Reports with PDF or...?
by rbi (Monk) on Apr 16, 2003 at 09:13 UTC
    In order to create PDFs I've installed html2ps, written in Perl, and Ghostscript that has the ps2pdf utility.
    And then I do something like this in my CGI appplications:
    my $HTML2PS = '/usr/local/bin/html2ps -L'; my $PS2PDF = '/usr/bin/ps2pdf'; # First create an HTML file that I want to print my $h2p = "<html><head></head><body> <img src=$pngfile> </body></html>"; my $file_to_ps = "$plot_file_base".'_to_ps.htm'; open (FH,">$file_to_ps") or die "cannot open $file_to_ps: $!\n"; print FH $h2p; close(FH); # Then create a ps file my $file_ps = "$plot_file_base".'.ps'; system "$HTML2PS $file_to_ps > $file_ps"; #And finally convert it to PDF my $file_pdf = "$plot_file_base".'.pdf'; system "$PS2PDF $file_ps $file_pdf"; unlink $file_to_ps; unlink $file_ps;
    It's under Linux, but will probably work under other OSs. Hope this helps.

    Ciao, Roberto
Re: Paper Reports with PDF or...?
by nite_man (Deacon) on Apr 16, 2003 at 06:19 UTC
    I use for creation of print view of some documents tool htmldoc, which convert html page into PDF or PS. Of course, this is not Perl solution, but I think that PDF Perl modules are good solution if you create new PDF but if you want to convert some existing document (HTML page), I think (! it's only my opinion !), that it's better to use this tool or something the same.
    SV* sv_bless(SV* sv, HV* stash);

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2022-05-17 19:58 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (68 votes). Check out past polls.