Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by poj (Priest)
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 contemplating the Monastery: (8)
As of 2014-10-24 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (137 votes), past polls