[cgiapp] How to send pdf file?
Michael Peters
mpeters at plusthree.com
Fri Feb 1 11:50:14 EST 2008
petr.vojkovsky at centrum.cz wrote:
> Hi,
> I want send to browser pdf file (it exist):
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