Subject: | addFont method |
Date: | Thu, 12 Oct 2006 15:31:38 +0200 |
To: | bug-CAM-PDF [...] rt.cpan.org |
From: | Gerhardus Muller <gerhardus [...] erd.co.za> |
Good Day
Method: addFont in PDF.pm
Problem: Font resources per page are not added correctly if the existing page has no font definitions.
Document Type: PDFs created by tiff2pdf have no font resources defined per page (tiffs are fax tiffs).
Please see the comments in the code below.
<snip>
# Add the font to the page
my ($objnum,$gennum) = $self->getPageObjnum($pagenum);
if (!exists $page->{Resources})
{
$page->{Resources} = CAM::PDF::Node->new('dictionary', {}, $objnum, $gennum);
}
my $r = $self->getValue($page->{Resources});
if (!exists $r->{Font})
{
# note the new font dictionary is added to the page dictionary instead of
# the resources dictionary.
# original line:
$page->{Font} = CAM::PDF::Node->new('dictionary', {}, $objnum, $gennum);
# suggested this is changed to:
$r->{Font} = CAM::PDF::Node->new('dictionary', {}, $objnum, $gennum);
}
my $f = $self->getValue($r->{Font});
$f->{$label} = CAM::PDF::Node->new('reference', $fontobjnum, $objnum, $gennum);
Regards
Gerhardus Muller