Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by poj (Curate)
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; }
poj


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (13)
As of 2014-07-24 17:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (163 votes), past polls