Just create some text between the tables. You need to be careful the text is not too low down the page though. Here's a example for you

#!/usr/bin/perl use strict; use warnings; use PDF::API2; use PDF::Table; # #A4 Landscape my $width = 842; my $height = 595; my $left_edge = 50; my $pdf = new PDF::API2(-file => "loren.pdf"); $pdf->mediabox($width, $height); my $font_HB = $pdf->corefont('Helvetica-Bold'); my $font_H = $pdf->corefont("Helvetica"); my $page_num; my $page = _page(); my ($x,$y) = ($left_edge,500); # create 5 tables for my $t (1..5){ # create new page if caption too low if ($y < 100){ $page = _page(); $y = 500; } # add caption for table my $caption = $page->text(); $caption->font($font_HB, 12); $caption->translate($x,$y); $caption->text("Caption for table $t"); # create table my ($nextpage,$new_y) = _table($pdf,$page,$y,_data(3 + int(rand(10)) +)); $page = $nextpage; # gap to next table $y = $new_y - 20; }; # create table sub _table { my ($pdf,$page,$boty,$data) = @_; my $pdftable = new PDF::Table; my ($next_page, undef, $new_y) = $pdftable->table( $pdf, $page, $data, x => $left_edge, # center main table on the page w => 650, # 495 width of main table on the page start_y => $boty-10, next_y => 500, start_h => $boty-10, next_h => 500, new_page_func => \&_page, # it brings header to other pages padding => 5, padding_right => 10, border => 0, background_color_odd => "lightgray", background_color_even => "lightblue", ); return ($next_page,$new_y); }; # create new page sub _page { ++$page_num; my $page = $pdf->page; # 3 lines of header text of each page my $t = $page->text(); $t->font($font_HB, 12); $t->translate(20,550); $t->text("Header for Page $page_num"); $t->cr(-12); $t->font($font_H, 11); $t->text("Header 2"); $t->cr(-12); $t->font($font_H, 10); $t->text("Header 3"); # horiz line my $g = $page->gfx(); $g->linewidth(1); $g->move(20,520); $g->line($width-20,520); $g->stroke; # page num $g->textlabel(760,15,$font_H,8,"Page $page_num", -color => '#808080', -align => 'right', ); return $page; }; $pdf->saveas(); # get random test data sub _data { my $lines = shift; print $lines." data lines \n"; my @data=(); my $ar1 = ["Y Lorem ipsum dolor", "Donec odio neque, faucibus vel", +"consequat quis, tincidunt vel, felis.", "Header", "Header", "Header" +]; my $ar2 = ["Nulla euismod sem eget neque.", "Donec odio neque", "Sed + eu velit.", "Header", "Header", "Header"]; for (1..$lines) { push @data,$ar1,$ar2; } return \@data; };
poj

In reply to Re^7: Making PDF Tables by poj
in thread Making PDF Tables by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.