in reply to Looping in PDF::Table module
As you have provided incomplete code with no example data and no error messages, it is difficult to say where your problem is.
The documentation for PDF::Table indicates that your data should be in an array.
It can be used to display text data in a table layout within the PDF. The text data must be in a 2d array (such as returned by a DBI statement handle fetchall_arrayref() call).Perhaps if you loop over your data to construct your array then pass that to generate the table in the pdf, it will do what you want.
Here is a rough example of how your code could be modified, as the code is incomplete this is untested.
my @tabledata; foreach my $ship_prod (@SHIP_PRODS){ my($_t_id,$p_id,$stat_id,$qty) = split(/$SEP_CHAR/,$ship_prod); $rows = ["", "$ALL_PRODS{$p_id}",""]; if(exists($ALL_MAN{$p_id}) && length($ALL_MAN{$p_id}) > 0){ $rows = ["", "$ALL_MAN{$p_id}",""]; } push @tabledata, $rows; } # build the table layout $pdftable->table( # required params $pdf, $page, \@tabledata, x => 5, start_y => 470, next_y => 450, start_h => 200, next_h => 250, # some optional params w => 600, padding => 5, padding_right => 10, font_size => 8, )
A few brief pointers on your code:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Looping in PDF::Table module
by divinafaudan (Initiate) on Jul 25, 2013 at 05:12 UTC | |
by Eliya (Vicar) on Jul 25, 2013 at 14:07 UTC | |
by rnewsham (Curate) on Jul 25, 2013 at 07:12 UTC | |
by divinafaudan (Initiate) on Jul 25, 2013 at 09:17 UTC | |
by rnewsham (Curate) on Jul 25, 2013 at 11:30 UTC |