Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: PDF API2 rect fill not displayed in android pdf viewer

by Anonymous Monk
on Apr 09, 2018 at 12:33 UTC ( #1212581=note: print w/replies, xml ) Need Help??

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


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');

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1212581]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2020-10-20 12:22 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (210 votes). Check out past polls.