File: Weblink.pm

package info (click to toggle)
libpdf-fromhtml-perl 0.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 576 kB
  • sloc: perl: 4,876; makefile: 15
file content (91 lines) | stat: -rw-r--r-- 1,338 bytes parent folder | download
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package PDF::FromHTML::Template::Element::Weblink;

use strict;

BEGIN {
    use vars qw(@ISA);
    @ISA = qw(PDF::FromHTML::Template::Element);

    use PDF::FromHTML::Template::Element;
}

sub render
{
    my $self = shift;
    my ($context) = @_;

    return 0 unless $self->should_render($context);

    return 1 if $context->{CALC_LAST_PAGE};

    my $url = $context->get($self, 'URL');

    unless (defined $url)
    {
        warn "Weblink: no URL defined!", $/;
        return 1;
    }

    my @dimensions = map {
        $context->get($self, $_) || 0
    } qw( X1 Y1 X2 Y2 );

    $context->{PDF}->add_weblink( @dimensions, $url );

    return 1;
}

1;
__END__

=head1 NAME

PDF::FromHTML::Template::Element::WebLink - To provide a clickable web-link

=head1 NODE NAME

WEBLINK

=head1 INHERITANCE

PDF::FromHTML::Template::Element

=head1 ATTRIBUTES

=over 4

=item * URL
The URL to go to, when clicked

=item * X1 / X2 / Y1 / Y2

The dimensions of the clickable area

=back

=head1 CHILDREN

None

=head1 AFFECTS

Nothing

=head1 DEPENDENCIES

None

=head1 USAGE

This node is currently under review as to whether it should be removed and a
URL attribute should be added to various nodes, such as IMAGE, TEXTBOX, and ROW.

=head2 USE AT YOUR OWN RISK

=head1 AUTHOR

Rob Kinyon (rkinyon@columbus.rr.com)

=head1 SEE ALSO

=cut