Task Have a CGI-script which produces an .*pdf file from the html-content/page
Problem: When launched from the web browser, there is no creation of the pdf document.
Steps So far:
- chmod settings set to above recommended (777)
- tested normal output to file from the script, which works fine
- when run locally on the server from the command line, the *.cgi script works
Question: Why does the script not work when run from the web browser?
#!/usr/bin/perl
use LWP::Simple;
use HTML::HTMLDoc;
use CGI;
print "Content-type: text/html\n\n";
print "<html><head><title>test</title></head>";
print "<body>";
my $htmldoc->set_html_content(qq~<html><body>A PDF file</body></html>~);
my $pdf = $htmldoc->generate_pdf() or die($!);
$pdf->to_file('/var/www/tom.pdf');
print "</body></html>";