Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: How to construct @data for PDF::Report::Table->addTable

by poj (Vicar)
on Aug 11, 2013 at 07:43 UTC ( #1048983=note: print w/ replies, xml ) Need Help??

in reply to How to construct @data for PDF::Report::Table->addTable

If it's any help this produces a pdf but with warnings : Incorrect Table Geometry ! Setting bottom margin to end of sheet and doesn't set the 2nd page to Landscape.

#!perl; use strict; use PDF::Report; use PDF::Report::Table; # test data rows=20 my $ar = testdata(20); my $pdf = new PDF::Report('PageSize' => 'LETTER', 'PageOrientation' => 'Landscape',); $pdf->newpage(); my ($width, $height) = $pdf->getPageDimensions(); my $margin = 50; $pdf->setAddTextPos($margin,$height-$margin); my $tbl_wrt = PDF::Report::Table->new($pdf); $tbl_wrt->addTable([@$ar],$width-$margin*2,5,'#ffffff','#ffffcc'); $pdf->saveAs('testA.pdf'); sub testdata{ my $rows = shift; my @ar=(); push @ar ,[$_, "col2-$_", "col3-$_", "col4-$_", "col5-$_", "a very wide column 6-$_ that has a lot of text and more than 1 line"] for (1..$rows); return \@ar; }

Comment on Re: How to construct @data for PDF::Report::Table->addTable
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1048983]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2015-10-07 03:32 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (170 votes), past polls