PDF :: FromHTML-损坏的文件且无输出 [英] PDF::FromHTML - Corrupt file and no output
本文介绍了PDF :: FromHTML-损坏的文件且无输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类似于此帖子 PDF :: FromHTML创建空PDF
我有以下代码
$textblob='<html><head></head><body><p>HelloWorld</p></body></html>';
my $output;
if(defined($query->param('PDF'))){
my $pdf = PDF::FromHTML->new( encoding => 'utf-8' );
$pdf->load_file(\$textblob);
$pdf->convert(
# With PDF::API2, font names such as 'traditional' also works
Font => 'Arial',
LineHeight => 10,
Landscape => 1,
);
$pdf->write_file(\$output);
print $output;
}
在Firefox中,这只是给我一个空白的PDF页面,当我保存该页面并在Acrobat中查看时,它报告文件已损坏/损坏并且无法修复.TIA.
In Firefox this simply gives me an empty PDF page, when I save the page and view it in Acrobat it reports the file is corrupt/damaged and cannot be repaired. TIA.
推荐答案
我的错误在脚本的其他位置,感谢您的查找/注释(请注意:
My error was elsewhere in the script thanks for looking/commenting (note do not :
binmode STDOUT,':encoding(UTF-8)';
binmode STDOUT, ':encoding(UTF-8)';
如果您想使用此模块(obvs).
if you want to use this module obvs).
当然,由于某些未知原因,锚定现在不起作用/出现:-(
Of course the Anchors don't work/appear now for some unknown reason :-(
这篇关于PDF :: FromHTML-损坏的文件且无输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文