Why don't the images fully display when I convert HTML to PDF with Perl's HTML::HTMLDoc?
- by Octopus
I need to create a PDF file from the HTML I have created usign rrdcgi. This page contains the details and graphs in PNG format. I have written the below code using Perl module HTML::HTMLDoc to create a PDF file using saved HTML file. The images are of size width 1048 and hight 266 but when creating a PDF file the images are not shown completly from the right side.
#!/usr/bin/perl
use strict;
use warnings;
use HTML::HTMLDoc;
my $filename = shift;
my $htmldoc = new HTML::HTMLDoc();
$htmldoc->set_input_file($filename);
$htmldoc->no_links();
$htmldoc->landscape();
$htmldoc->set_jpeg_compression('50');
$htmldoc->best_image_quality();
$htmldoc->color_on();
$htmldoc->set_right_margin('1', 'mm');
$htmldoc->set_left_margin('1', 'mm');
$htmldoc->set_bodycolor('#FFFFFF');
$htmldoc->set_browserwidth('1000');
my $pdf = $htmldoc->generate_pdf();
$pdf->to_file('foo.pdf');
I need help on following items:
1) How do I display the complete image on page.
2) How do I set a link on HTML page to create PDF file with the contents on the current page.
Any help with the Perl code would be really appreciated.