I am just playing around with this, and have run into a problem I cannot fix. Here is the code:
Basically the effect I want is rows of columnar data, with every other row having a light gray background (I'll make it more dynamic, etc. after I prove I can do it).
The problem is that the rectangle covers the text. I tried this:
...but what I get with that is the same problem, AND the text below the rectangle is changed to the rectangle's fill color.
Any ideas??
Code:
use PDF::API2;
my @cols = @ARGV;
my $yLoc = 720;
my $pdf = PDF::API2->new(-file => "$0.pdf");
$pdf->mediabox(595,842);
my $page = $pdf->page;
my $box = $page->gfx();
$box->fillcolor( 'lightgrey' );
$box->rect(40, 718, 532, 13);
$box->fill;
my $fnt = $pdf->corefont('Arial',-encoding => 'latin1');
my $txt = $page->text;
$txt->font($fnt, 9);
$txt->textstart;
$txt->translate($cols[0],$yLoc);
$txt->text("1234");
$txt->translate($cols[1],$yLoc);
$txt->text("DP");
# More of the same follows....
$yLoc -= 12;
$txt->translate($cols[0],$yLoc);
$txt->text("5678");
$txt->translate($cols[1],$yLoc);
$txt->text("RQ");
# More of the same follows....
$txt->textend;
$pdf->save;
$pdf->end();
Basically the effect I want is rows of columnar data, with every other row having a light gray background (I'll make it more dynamic, etc. after I prove I can do it).
The problem is that the rectangle covers the text. I tried this:
Code:
my $box = $page->gfx(1);
...but what I get with that is the same problem, AND the text below the rectangle is changed to the rectangle's fill color.
Any ideas??