File: PdfTemplate.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 (125 lines) | stat: -rw-r--r-- 2,197 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package PDF::FromHTML::Template::Container::PdfTemplate;

use strict;

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

    use PDF::FromHTML::Template::Container;
}

sub new {
    my $class = shift;
    my $self = $class->SUPER::new(@_);

    # The default color is black
    $self->{COLOR} = '0,0,0' unless exists $self->{COLOR};

    return $self;
}

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

    return 1;
}

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

    $self->enter_scope($context);

    my $child_success = $self->SUPER::render($context)
        if $self->should_render($context);

    $self->exit_scope($context);

    return $child_success;
}

#sub preprocess {
#    my $self = shift;
#    my ($context) = @_;
#
#    $self->enter_scope($context);
#
#    $context->{PARAM_MAP}[0]{__LAST_PAGE__} = 0;
#    unless ($context->get($self, 'NOLASTPAGE')) {
#        my $old_PDF = $context->{PDF};
#
#        my $p = PDF::Writer->new;
#        $p->open() or die "Could not open buffer.", $/;
#
#        $context->{PDF} = $p;
#
#        $context->{CALC_LAST_PAGE} = 1;
#        $self->SUPER::render($context);
#        $context->{CALC_LAST_PAGE} = 0;
#
#        $p->close;
#        $self->reset;
#        $context->delete_fonts;
#
#        $context->{PDF} = $old_PDF;
#        $context->{PARAM_MAP}[0]{__LAST_PAGE__} = $context->{PARAM_MAP}[0]{__PAGE__} - 1;
#        $context->{PARAM_MAP}[0]{__PAGE__} = 1;
#        $context->{PARAM_MAP}[0]{__PAGEDEF__} = 0;
#    }
#
#    $self->exit_scope($context, 1);
#
#    return 1;
#}

1;
__END__

=head1 NAME

PDF::FromHTML::Template::Container::PdfTemplate - Provides the root PdfTemplate node

=head1 NODE NAME

PDFTEMPLATE

=head1 INHERITANCE

PDF::FromHTML::Template::Container

=head1 ATTRIBUTES

=over 4

=item * NOLASTPAGE - If this is set to true, then __LAST_PAGE__ will not be
calculated. This can provide a decent speed improvement.

=back

=head1 CHILDREN

None

=head1 AFFECTS

Nothing

=head1 DEPENDENCIES

None

=head1 USAGE

  <pdftemplate>
    ... Children here ...
  </pdftemplate>

=head1 AUTHOR

Rob Kinyon (rkinyon@columbus.rr.com)

=head1 SEE ALSO

=cut