[cgiapp] How to send pdf file?
petr.vojkovsky at centrum.cz
petr.vojkovsky at centrum.cz
Sun Feb 3 05:14:18 EST 2008
Hi Michael,
thank you for your answer.
MIME headers are correct, but I still don't know how to send binary output through CGI::Application.
On "classic" way it is easy:
open(FILE, "<test.pdf");
@fileholder = <FILE>;
close (FILE);
print "Content-Type: application/pdf\n";
print "Content-Disposition: attachment;filename=test.pdf\n\n";
print @fileholder;
How to do it through CGI::Application?
Petr
petr.vojkovsky at centrum.cz wrote:
> Hi,
> I want send to browser pdf file (it exist):
mpeters at plusthree.com wrote:
>If it already exists, it's much easier than that. Basically you just tell the
>browser where to find the file and what type it is:
>sub send_pdf {
>my $self = shift;
>$self->header_type('none'); # let's you set your own headers
>$self->header_props(
>-content-type => 'application/pdf',
>-content-disposition' => 'inline; filename=myfile.pdf'
>);
>
>return 'Download myfile.pdf';
>}
>Or something like that. It's kind of tricky when you need to deal with caching,
>SSL and IE - http://support.microsoft.com/kb/316431, but if you don't then it's
>pretty easy.
>--
>Michael Peters
>Developer
>Plus Three, LP
More information about the cgiapp
mailing list