.pdf
我有一个从 HTML 页面生成文件的 CGI 脚本。我的问题是,当它从 Web 浏览器启动时,没有创建.pdf
文档。
到目前为止我做了什么:
- chmod 设置设置为上述建议 (777)
- 测试了脚本文件的正常输出,效果很好
- 从命令行在服务器上本地运行时,
.cgi
脚本有效
为什么从 Web 浏览器运行时脚本不起作用?
#!/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>";