Subject: | Crash when rendinging simple <img> in a table <td> cell |
My system
=========
From the install:
CPAN.pm: Going to build A/AU/AUDREYT/PDF-FromHTML-0.21.tar.gz
*** Module::AutoInstall version 1.03
*** Checking for Perl dependencies...
[Core Features]
- List::Util ...loaded. (1.13)
- XML::Twig ...loaded. (3.17)
- Graphics::ColorNames ...loaded. (1.05)
- LWP::Simple ...loaded. (1.41)
- Image::Size ...loaded. (2.992)
- PDF::Writer ...loaded. (0.06 >= 0.05)
Also perl -v gives:
perl, v5.8.4 built for i386-linux-thread-multi
And uname -a gives:
Linux 2.4.26-bytemark-uml-20040706-1 #1 Tue Jul 6 09:37:31 BST 2004 i686
GNU/Linux
(a Debian Sarge UML virtual machine, with the stable versions of as many
Perl modules as I could find, plus CPAN install of PDF::FromHTML)
Replicating the problem
=======================
Using this code:
#!/usr/bin/perl
use strict;
use warnings;
use PDF::FromHTML;
my $html_statement = shift @ARGV;
my $pdf_statement = "$html_statement.pdf";
my $converter = PDF::FromHTML->new();
$converter->load_file($html_statement);
$converter->convert();
$converter->write_file($pdf_statement);
And the file test.html like this:
<HTML>
<BODY>
<table><tr><td><img src="cpan.jpg" ></td></tr></table>
</BODY>
</HTML>
Where almost any image seems to do, I used:
http://rt.cpan.org/NoAuth/images/cpan.jpg
Running this command:
perl html2pdf.pl test.html
Gets this error:
Use of uninitialized value in string eq at
/usr/local/share/perl/5.8.4/PDF/FromHTML/Twig.pm line 200.
Use of uninitialized value in subtraction (-) at
/usr/local/share/perl/5.8.4/PDF/FromHTML/Twig.pm line 308.
/tmp/dvtHTrDA1b.xml: 'TABLE' () didn't make a node!
Debugging it, it seems to be because there is no key in
%PDF::FromHTML::Template::Factory::isBuildable for 'TABLE', however I'm
not sure if this is a knock-on error, and I'm not sure how to fix it in
any case.
It goes away if the <img> tag is removed, or if the <tr> or <td> tags
are removed (but of course then the output isn't what I want).