| PDF-FromHTML documentation | Contained in the PDF-FromHTML distribution. |
PDF::FromHTML::Template::Element
To provide a base class for all rendering nodes.
This is the class that handles colors. Colors in PDF::FromHTML::Template are specified in RGB format, comma-separated. Each number is from 0 to 255, with 0 being none and 255 being most. If a color is not specified, 0 is assumed. Thus, "255,0,0", "255,0", and "255" will all result in a red color.
Colors should be used for all attributes that have the word "COLOR" in the name. This includes (but may not be limited to):
| PDF-FromHTML documentation | Contained in the PDF-FromHTML distribution. |
package PDF::FromHTML::Template::Element; use strict; BEGIN { use vars qw(@ISA); @ISA = qw(PDF::FromHTML::Template::Base); use PDF::FromHTML::Template::Base; } sub set_color { my $self = shift; my ($context, $attr, $mode, $depth) = @_; my $color = $context->get($self, $attr, $depth); return 1 unless $color; my @colors = map { $_ / 255 } split /,\s*/, $color, 3; $context->{PDF}->color($mode, 'rgb', @colors); return 1; } 1; __END__