Why don't the images fully display when I convert HTML to PDF with Perl's HTML::HTMLDoc?

Posted by Octopus on Stack Overflow See other posts from Stack Overflow or by Octopus
Published on 2010-03-29T08:01:31Z Indexed on 2010/03/29 20:13 UTC
Read the original article Hit count: 489

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about perl

Related posts about pdf