2008/12/12 ChrisC <gjwp...@gmail.com>:
> Hi!

Hi,

> How to underline text using PDF::API2?
>
> Currently using following to print text:
>
>   sub print_pdf_text {
>    my $xp   = shift;
>    my $yp   = shift;
>    my $fnt  = shift;
>    my $Mfnt = shift;
>    my $text = shift;
>
>    $txt->font( $fnt, $Mfnt);
>    $txt->translate( $xp, $yp -= 12 );
>    $txt->text( $text );
>  }
>

Have a look at

http://search.cpan.org/~areibens/PDF-API2-0.72.003/lib/PDF/API2/Content.pm

$width = $txt->text $text, %options
    Applys text to the content and optionally returns the width of the
given text.

    Options

-indent
    Indent the text by the number of points.

-underline
    If this is a scalar, it is the distance, in points, below the
baseline where the line is drawn. The line thickness is one point. If
it is a reference to an array, each pair is the distance below the
baseline and the thickness of the line (ie., -underline=>[2,1,4,2]
will draw a double underline with the lower twice as thick as the
upper).

    If thickness is a reference to an array, the first value is the
thickness and the second value is the color of the line (ie.,
-underline=>[2,[1,'red'],4,[2,'#0000ff']] will draw a ``red'' and a
``blue'' line).

    You can also use the string 'auto' for either or both distance and
thickness values to auto-magically calculate best values from the
font-definition.


Good Luck,
Dp.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to