Re: [cgiapp] How to send pdf file?

2008-02-04 Thread Michael Peters
Lou Hernsen wrote:
> I klnow how to send an email with text.
> How to I send an email with HTML in it?
> Is there a special header or command or what?

Wow, can you say completely unrelated to this topic :) Next time, try starting a
new thread. Not only will it not confuse people, but several people are probably
 already tuned out to the PDF conversation. So you're also missing out on an
audience.

Their called MIME emails. Do a search CPAN. I've used MIME::Lite with some
success, but it's not really "lite". I think Email::MIME is one of the preferred
modules now.

-- 
Michael Peters
Developer
Plus Three, LP


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




RE: Re: [cgiapp] How to send pdf file?

2008-02-03 Thread Jesse Erlbaum
Hi Petr --

> 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, " @fileholder = ;
> 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?


It's basically the same w/ CGI::Application, with two exceptions:

  1. You don't return the headers.  You set them.
  2. You don't print -- you return your data.


  sub send_pdf {
my $self = shift;

$self->header_props( -type => "application/pdf",
 -"Content-Disposition"=>"attachment;filename=test.pdf"
   );

open(FILE, ";
close (FILE);

return join("", @fileholder);
  }


TTYL,

-Jesse-

 
Jesse Erlbaum
The Erlbaum Group, LLC
817 Broadway, 10th floor
New York, NY 10003
212-684-6161 (office)
917-647-3059 (mobile)
212-684-6226 (fax)
[EMAIL PROTECTED]




#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] How to send pdf file?

2008-02-01 Thread Michael Peters
[EMAIL PROTECTED] 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


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####