Subject: | Not able to Convert a HTML file to PDF |
Hi,
I have installed HTML-HTMLDoc-0.11_01 and HTMLdoc on Linux 2.6.9-78.EL
x86_64 x86_64 x86_64 GNU/Linux.
Now I am able to convert HTML text written in the same file, but when I
am trying by convert html file from File System, it shows the following
error...
Can't call method "filename" without a package or object reference at
/usr/lib/perl5/site_perl/5.8.5/HTML/HTMLDoc.pm line 1052.
Attached is the program that I am using.
I will be highly thankful to you.
Thanks & Regards,
Vishesh Dahiya
Subject: | htmltopdf.pl |
#!/usr/bin/perl
use HTML::HTMLDoc;
my $htmldoc = new HTML::HTMLDoc();
$f = "/tmp/test.html";
# $htmldoc->set_html_content(qq~<html><body>Hello Mr. Deepak k , <hr> <br>Welcome</body></html>~);
$htmldoc->set_input_file($f); # alternative to use a present file from your fs
my $pdf = $htmldoc->generate_pdf();
print $pdf->to_string();
$pdf->to_file('test.pdf');