能否在使用PERL的浏览器中投出一个 pdf? 我的闪电申请是寄送已久的pdf双通到永久的。 pdf来自AlivePDF。
#!C:Perlinperl.exe
##
BEGIN { $ENV{PATH} = ; delete @ENV{ IFS , CDPATH , ENV , BASH_ENV }; }
use strict;
use warnings;
no warnings qw (redefine closure);
use CGI;
my $CGI = new CGI();
#name=generated.pdf&method=inline these are passed via the URL and are in the environmental variable QUERY_STRING
my %nv_pairs = map{my @tmp = split(/=/,$_);$tmp[0] => $tmp[1] }split(/&/,$ENV{QUERY_STRING});
my $name = $nv_pairs{name};
my $method = $nv_pairs{method};
#Raw Data is stored in the POST Parameter POSTDATA
my $pdf = $CGI->param( POSTDATA );
print "Content-Type: application/pdf
";
print "Content-Length: " . length($pdf) . "
";
print "Content-Disposition :$method
";
print $pdf;
The problem is that I want to actually render what a pdf will look like. I can save that binary code and open it manually in Adobe Reader and it renders properly.
我愿意在浏览器上发言,但我不知道如何做到这一点。
Currently the output (what the browser displays), looks like this:
Content-Type: application/pdf
Content-Length: 432785
Content-disposition:inline; filename="test.pdf"
%PDF-1.5
1 0 obj
<</Type /Pages
/Kids [3 0 R 5 0 R]
/Count 2>>
endobj
3 0 obj
<</Type /Page
/Parent 1 0 R
/MediaBox [0 0 612.00 792.00]
/Resources 2 0 R
这只是所展示的档案的一部分,但我希望这样做。 我不想显示该守则,我希望它看图象。 如果我下载这一档案,并将延期至.pdf,它就非常有效。