[Melbourne-pm] Delivering PDFs via CGI
Guy Morton
guy at alchemy.com.au
Mon Jun 19 02:12:54 PDT 2006
Sounds like your file associations are bad on that PC if that's the
case. At any rate, the workaround *does* work for me so perhaps you have
an error in your code somewhere? Perhaps you could post your code, and
details of browser, OS etc you are testing with?
Are you being careful to only put two new line characters on the end of
your *last* header?
Guy
Leigh Sharpe wrote:
> Tried that, too. IE then attempted to open the PDF with Word. And
> failed miserably to do so.
>
> Regards,
> Leigh
>
> Leigh Sharpe
> Network Systems Engineer
> Pacific Wireless
> Ph 9584 8966
> Mob 0408 009 502
> email lsharpe at pacificwireless.com.au
> <blocked::mailto:lsharpe at pacificwireless.com.au>
> web www.pacificwireless.com.au
> <blocked::http://www.pacificwireless.com.au/>
>
>
> ------------------------------------------------------------------------
> *From:* Guy Morton [mailto:guy at alchemy.com.au]
> *Sent:* Monday, June 19, 2006 4:55 PM
> *To:* Leigh Sharpe
> *Subject:* Re: [Melbourne-pm] Delivering PDFs via CGI
>
> try adding a content-disposition line and put a filename in it, eg
>
>> print "Content-Type: application/pdf\n";
>> print "Content-Disposition: attachment;
>> filename=youradhere.pdf\n";
>> print "Content-Transfer-Encoding: binary\n\n";
> hth
>
> Guy
>
> Leigh Sharpe wrote:
>> Hi All,
>> Is it just me or has this list been really quiet recently?
>>
>> Can anybody tell me how to output PDF files to a browser properly?
>> Specifically, I'm having trouble getting Internet Explorer to
>> recognise them as PDFs.
>> This, for example:
>>
>> #!c:\perl\bin\perl.exe
>> use warnings;
>> use strict;
>> my $filename="c:\\temp\\mypdf.pdf";
>> my $data;
>> print "content-type:application/pdf\n\n";
>> open (PDFFILE,"<$filename") or die "$!\n";
>> binmode PDFFILE;
>> binmode STDOUT;
>> my $size = -s "$filename";
>> read PDFFILE,$data,$size || die"$!\n";
>> close PDFFILE;
>> print $data;
>>
>>
>> Works perfectly when accessed using Mozilla. Using IE, I just get a
>> screen full of garbage.
>> If I use a URL that ends in ".pdf", it works. eg, instead of
>> http://localhost/cgi-bin/mime.cgi, use
>> http://localhost/cgi-bin/mime.cgi?fred.pdf. All works fine.
>> Is this a bug in my browser, or am I overlooking something here?
>> I find the same problem with MS-Word documents. I need to have
>> a paramater which ends in ".doc" in order to have IE open a word doc
>> automatically.
>>
>>
>>
>> Regards,
>> Leigh
>>
>> Leigh Sharpe
>> Network Systems Engineer
>> Pacific Wireless
>> Ph 9584 8966
>> Mob 0408 009 502
>> email lsharpe at pacificwireless.com.au
>> <blocked::mailto:lsharpe at pacificwireless.com.au>
>> web www.pacificwireless.com.au
>> <blocked::http://www.pacificwireless.com.au/>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Melbourne-pm mailing list
>> Melbourne-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/melbourne-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20060619/5aa5475d/attachment.html
More information about the Melbourne-pm
mailing list