PDF::ReportWriter

PDF::ReportWriter is a Perl module that produces high-quality PDF reports from a report definition and a data array.
Download

PDF::ReportWriter Ranking & Summary

Advertisement

  • Rating:
  • License:
  • LGPL
  • Price:
  • FREE
  • Publisher Name:
  • Daniel Kasak
  • Publisher web site:
  • http://search.cpan.org/~dkasak/Gtk2-Ex-DBI-2.0/lib/Gtk2/Ex/DBI.pm

PDF::ReportWriter Tags


PDF::ReportWriter Description

PDF::ReportWriter is a Perl module that produces high-quality PDF reports from a report definition and a data array. PDF::ReportWriter is a Perl module that produces high-quality PDF reports from a report definition and a data array.PDF::ReportWriter supports text formatting and alignment, unlimited grouping with group functions, intelligent page breaking, image support, color support, shaped cell backgrounds, and numeric formatting.USAGEThe example below is purely as a reference inside this documentation to give you an idea of what goes where. It is not intended as a working example - for a working example, see the demo application package, distributed separately at http://entropy.homelinux.org/axis_not_evilFirst we set up the top-level report definition and create a new PDF::ReportWriter object ...$report = { destination => "/home/dan/my_fantastic_report.pdf", paper => "A4", orientation => "portrait", template => '/home/dan/my_page_template.pdf', font_list => , default_font => "Times", default_font_size => "10", x_margin => 10 * mm, y_margin => 10 * mm, info => { Author => "Daniel Kasak", Keywords => "Fantastic, Amazing, Superb", Subject => "Stuff", Title => "My Fantastic Report" }};my $pdf = PDF::ReportWriter->new( $report );Next we define our page setup, with a page header ( we can also put a 'footer' object in here as well )my $page = { header => };Define our fields - which will make up most of the reportmy $fields = ;I've defined a custom colour_func for the 'Appraisal' field, so here's the sub:sub red_if_fantastic { my $data = shift; if ( $data eq "Fantastic" ) { return "red"; } else { return "black"; }}Define some groups ( or in this case, a single group )my $groups = ;We need a data array ...my $data_array = $dbh->selectall_arrayref( "select Date, Item, Appraisal from Entries order by Date" );Note that you MUST order the data array, as above, if you want to use grouping. PDF::ReportWriter doesn't do any ordering of data for you.Now we put everything together ...my $data = { background => { # Set up a default background for all cells ... border => "grey" # ... a grey border }, fields => $fields, groups => $groups, page => $page, data_array => $data_array, headings => { # This is where we set up field header properties ( not a perfect idea, I know ) background => { shape => "box", colour => "darkgrey" } }};... and finally pass this into PDF::ReportWriter$pdf->render_data( $data );At this point, we can do something like assemble a *completely* new $data object, and then run $pdf->render_data( $data ) again, or else we can just finish things off here:$pdf->save; Requirements: · Perl


PDF::ReportWriter Related Software