http://qs321.pair.com?node_id=1212581


in reply to PDF API2 rect fill not displayed in android pdf viewer

***SOLVED***

My original code used the text method to draw the rectangle. It so happened that most browsers and some pdf viewers do not see this as a problem and render the line of text and the text over the rectangle (as desired). But apparently other pdf viewers are less forgiving of this.
use PDF::API2; my $pdf = PDF::API2->new(); my $page = $pdf->page(); my $text = $page->text(); my $font = $pdf->corefont('Helvetica-Roman'); $text->font($font, 16); $text->translate(50, 620); $text->text('Print some text'); # define rect with gfx my $rect = $page->gfx; $rect->rect(50, 560, 400, 18); $rect->fillcolor('#000000'); $rect->fill(); # Go back to text $text->fillcolor('#ffffff'); $text->translate(62, 565); $text->text('Print text in rect'); $pdf->saveas('test.pdf');