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

DBI to PDF

by jwherbold (Novice)
on Sep 12, 2002 at 19:31 UTC ( #197324=perlquestion: print w/replies, xml ) Need Help??

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

Help! I am looking for an easy way to take the results of an SQL statement through DBI and send the results to a PDF file. I can't find anything on it, and I just can't beleive that the problem has not come up before. What am missing ?

I know about the Perl Module, but I really don't want go through and code all of the X Y cords if someone else has done it already.

Thanks
John Herbold

Replies are listed 'Best First'.
Re: DBI to PDF
by mfriedman (Monk) on Sep 12, 2002 at 22:54 UTC
    How exactly is the data to be put in the PDF? You'll have to do a lot of coordinates and fonts and things whenever creating PDFs as its a rather involved format. You might find PDF::Template useful. You can create a template XML document and fill in the values later.
Re: DBI to PDF
by Popcorn Dave (Abbot) on Sep 12, 2002 at 23:15 UTC
    mfriedman is right. Without knowing what kind of data you have, or what you intend to do with it, it's kind of hard to help.

    That said, I just finished a project using PDF::Labels and it wasn't hard to use at all. Check all the PDF modules on CPAN to see if there's something written for what you intend to do with your data.

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

      Sorry about that, more detail...

      Just as you can write a small program to go through the answer set from an SQL statement and display the results (Multiple columns and multiple records) in an HTML table or even to an EXCEL file. It would be (more than nice) if you could send the results to a PDF file. As we use PERL to go against data in our Data Warehouse for reports that our users run. I love it, data comes back 100's of times faster than the "canned" reporting apps that we have. The only problem is that users want to be able to print out their reports. We all know that HTML is not pretty when it comes to printing, to wide to long etc... column headers do not repeat on all pages etc...

      As I said above, I was thinking about something that would take in account the font you want, the size you want, convert it into the resolution that the PDF module is wanting, find the maxium width of each column, and start laying out the data. Again you will have to check to make sure that you do not go off the edge of the page, and you will need to repeat report titles, and column headers on each page, add page numbers etc. I would think that a lot of people would need this kind thing, and would have bet money that it has been done already.

      Thanks

      John Herbold
Re: DBI to PDF
by jwherbold (Novice) on Sep 12, 2002 at 23:15 UTC
    I was thinking allong the lines...

    A given font a given size takes up so much room, so that each column in the data returned can be scanned through and found the maxium width. Then start placing columns on the page. If you go to far then start a second page, if the page is to long start another page... etc.

    John Herbold

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2021-08-05 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (44 votes). Check out past polls.

    Notices?