in reply to Re^6: Rotating a (PDF:::Table) Page Help!
in thread Rotating a (PDF:::Table) Page Help!

So what part of

the parameter 'new_page_func' must be a function reference

makes you think that passing a hash reference to it is the right way to go forward on this?

I looked into the source code of PDF::Table and it directly calls the new_table_func reference whenever it needs a new page:

if(ref $arg{'new_page_func'}) { $page = &{$arg{'new_page_func'}}; } else { $page = $pdf->page; }

... so, if you return to my above example, and modify it as follows:

... new_table_func => sub { my $next_page = $pdf->page; $next_page->rotate(90); return $next_page; },

that should be all you need. But feel free to pursue other approaches at your leisure.

Replies are listed 'Best First'.
Re^8: Rotating a (PDF:::Table) Page Help!
by Anonymous Monk on Mar 31, 2009 at 20:00 UTC
    OK, I am confused, could you add your implementation to the code I submitted and post it here so I can follow you?
    That would be nice! Thanks!!!

      Maybe you can tell me where you have problems. The documentation mentions exactly one occurrence of new_page_func in code. My code snippet also mentions one occurrence of new_page_func. Do you have problems to string the two occurrences together into one consecutive whole?

      I don't have PDF::Table installed, so I can't test any code. I will just take the synopsis and put my part into it:

      ($end_page, $pages_spanned, $table_bot_y) = $pdftable->table( $pdf, # A PDF::API2 instance $page_to_start_on, # A PDF::API2::Page instance created with $pa +ge_to_start_on = $pdf->page(); $data, # 2D arrayref of text strings x => $left_edge_of_table, #X - coordinate of upper left corne +r w => 570, # width of table. start_y => $initial_y_position_on_first_page, next_y => $initial_y_position_on_every_new_page, start_h => $table_height_on_first_page, next_h => $table_height_on_every_new_page, #OPTIONAL PARAMS BELOW max_word_length=> 20, # add a space after every 20th symbol in +long words like serial numbers padding => 5, # cell padding padding_top => 10, # top cell padding, overides padding padding_right => 10, # right cell padding, overides padding padding_left => 10, # left cell padding, overides padding padding_bottom => 10, # bottom padding, overides -padding border => 1, # border width, default 1, use 0 for no b +order border_color => 'red',# default black font => $pdf->corefont("Helvetica", -encoding => "utf8" +), # default font font_size => 12, font_color_odd => 'purple', font_color_even=> 'black', background_color_odd => 'gray', #cell background color f +or odd rows background_color_even => 'lightblue', #cell background color +for even rows new_page_func => sub { ... }, # see section TABLE SPANNING header_props => $hdr_props, # see section HEADER ROW PROPERTIES column_props => $col_props, # see section COLUMN PROPERTIES cell_props => $row_props, # see section CELL PROPERTIES )
        I got it, I already posted above, thank you for you help!!!
      Thank you, I got to work thanks to your code.
      Here is how:
      new_page_func => sub { my $next_page = $pdf->page; $next_page->mediabox(792,612); return $next_page; },

      I can sleep now until I figure out how to add a link to one of the values.