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();
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.