我在PERL中工作,並且我有一個完美顯示的html結果頁面。我想添加一個按鈕,使得這個HTML頁面成爲下載到你的機器上的pdf。以下是生成html頁面的代碼。 fileFH在CGI代碼中生成。將HTML結果頁轉換爲PDF並下載CGI文件
sub searchResults {
my $data = shift;
my $file = "$OUTFILES/$data.html";
open(my $fileFH, '<', $file) or return "Can not find file\n";
print $cgi->header();
while (<$fileFH>) {
print qq($_);
}
close($fileFH);
}
你能澄清,如果你需要幫助的代碼或者是您最感興趣的工具轉換成PDF? – mp3
您可能還想考慮不推薦使用CGI.pm生成html代碼。 https://metacpan.org/pod/distribution/CGI/lib/CGI.pod#HTML-Generation-functions-should-no-longer-be-used – mp3