Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
PDF::API" + Text with strokeby ademmler (Novice) |
on Oct 28, 2009 at 21:20 UTC ( [id://803804]=perlquestion: print w/replies, xml ) | Need Help?? |
ademmler has asked for the wisdom of the Perl Monks concerning the following question:
hi, I am using PDF::API2 and I try to make a Text having a green filling and a red stroke around the text. But I cant figure out how to get this. Here is my test script. Hoping somebody has the right idea. thx to all, alexander #!/usr/bin/perl # Sample code taken from: http://rick.measham.id.au/pdf-api2/ # Thanks to the author # use strict; use warnings; use PDF::API2; use constant mm => 25.4 / 72; use constant in => 1 / 72; use constant pt => 1; my $pdf = PDF::API2->new( -file => "$0.pdf" ); my $page = $pdf->page; $page->mediabox( 105 / mm, 35 / mm ); my %font = ( Helvetica => { Bold => $pdf->corefont( 'Helvetica-Bold', -encoding => 'latin1' ), Roman => $pdf->corefont( 'Helvetica', -encoding => 'latin1' ), Italic => $pdf->corefont( 'Helvetica-Oblique', -encoding => 'latin1' ), }, ); my $headline_text = $page->text; $headline_text->font( $font{'Helvetica'}{'Bold'}, 18 / pt ); $headline_text->fillcolor('green'); $headline_text->strokecolor('red'); $headline_text->linewidth(0.5 / mm); $headline_text->fillstroke('1'); $headline_text->stroke; $headline_text->translate( 95 / mm, 15 / mm ); $headline_text->text_right('My Headline'); $pdf->save; $pdf->end();
Back to
Seekers of Perl Wisdom
|
|