I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2012-01-27 02:08:53.58259-08 by acunningham
Blank document produced
Hello All! The following small program works correctly as a standalone program, and produces a valid PDF document:
#!/usr/bin/perl use HTML::HTMLDoc; my $htmldoc = new HTML::HTMLDoc(); $htmldoc->set_html_content(qq~<html><body>A PDF file</body></html>~); my $pdf = $htmldoc->generate_pdf(); print $pdf->to_string();
but the following code inserted into my main program produces an empty string:
my $htmldoc = new HTML::HTMLDoc(); $htmldoc->set_html_content(qq~<html><body>A PDF file</body></html>~); my $pdf = $htmldoc->generate_pdf(); dump( $htmldoc, $pdf, $pdf->to_string() );
The output from the dump, which invokes Data::Dumper, is:
$VAR1 = bless( { 'html' => '<html><body>A PDF file</body></html>', 'errors' => [], 'config' => { 'tmpdir' => '/tmp', 'mode' => 'ipc' }, 'doc_config' => { 'quiet' => undef, 'format' => 'pdf', 'charset' => 'iso-8859-1', 'portrait' => '', 'header' => '.t.', 'footer' => '.1.', 'size' => 'a4' } }, 'HTML::HTMLDoc' ); $VAR2 = bless( { 'content' => \'' }, 'HTML::HTMLDoc::PDF' ); $VAR3 = '';
Any ideas on what could be the cause?
Direct Responses: Write a response