-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Howdy,
On Wed, 10 Sep 2003, Steve Comrie wrote:
> > I think you're looking for the 'Content-disposition' header here. By
> > setting it to inline, it suggests to the browser to view it inline,
> > instead of prompting to save it.
>
> I've had success using the following header:
>
> Content-Type: application/octetstream\n
> Content-Disposition: attachment; filename=$filename\n\n
Great!
> You should be able to use the argument of 'none' to the CGIApp header_type()
> method.
> -------------------
> my $filename= 'the_pdf_file.pdf";
> my $output = get_pdf_contents();
> my $header= "Content-Type: application/octetstream\n";
> $header .= "Content-Disposition: attachment; filename=$filename\n\n";
>
> $self->header_type('none');
> return $header.$output;
Agreed, but that only surpresses the headers. You still have to read in
the entire PDF at once, and then pass it around as a reference.
You had asked for a way to send the PDF a few pieces at a time to
avoid having the entire file in memory at once. Setting
'$ENV{CGI_APP_RETURN_ONLY}', in combination with passing 'none' into
header_type(), does exactly that :-)
I was just saying that I hope that there might some day be a less cryptic
way of going about that. Perhaps it would work today by returning a hash
from the run_mode, instead of a string. Then, we could have an overloaded
stringify operation call a custom output procedure when CGI::App calls
"print $output" at the end of the run() method. That output procedure
would then read a file in, line by line, and avoid the overhead of
slurping it in during the run_mode. However, some might suggest that
doesn't really make it any less cryptic ;-)
-Eric
- --
Eric Andreychek | Lucy: "What happens if you practice the
Eric Conspiracy Secret Labs | piano for 20 years and then end up not
suppressed | being rich and famous?"
http://openthought.net | Schroeder: "The joy is in the playing."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE/XzX8R5UKaDAjAG4RAkRIAKDprvscM4P1mVWJ1JSvjSaLcSRs0wCgmabj
coqm0YqNwynpmf2HvfMI1UU=
=6cWs
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.