File: 020_textunderline

package info (click to toggle)
libpdf-builder-perl 3.027-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,992 kB
  • sloc: perl: 107,532; makefile: 10
file content (49 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl

use strict;
use warnings;

use lib '../lib';
use PDF::Builder;
use PDF::Builder::Util;

#my $compress = 'none';  # no stream compression
my $compress = 'flate';  # compressed streams

my $pdf = PDF::Builder->new(-compress => $compress);

my $f1 = $pdf->corefont('Helvetica', -encode=>'latin1');
my $f2 = $pdf->corefont('Helvetica-Bold', -encode=>'latin1');

my $page = $pdf->page();
$page->mediabox(595,842);

my $text = $page->text();
$text->textlabel(50,700, $f2, 20, 'Normal Text in Red (no underline)', -color=>'red');
$text->textlabel(50,600, $f2, 20, 'Normal Text in Blue Underline in Red+Yellow',
    -color=>'#0000CC',
    -rotate=>-45,
    -hscale=>65,
    -underline=>[4,[1,'red'],7,[1.5,'yellow'],11,2],
);

$text->textlabel(300,600, $f2, 20, 'Text Centered',
    -color=>'#0000CC',
    -rotate=>45,
    -center=>1,
    -underline=>[4,[2,'red']],
);

$text->textlabel(550,600, $f2, 20, 'Text Right',
    -color=>'#0000CC',
    -rotate=>-45,
    -right=>1,
    -underline=>[4,[2,'red']],
);

$pdf->saveas("$0.pdf");
$pdf->end();

exit;

__END__