[Melbourne-pm] Delivering PDFs via CGI

Guy Morton guy at alchemy.com.au
Mon Jun 19 00:51:09 PDT 2006


It's browser stupidity yes, but the workarounds that have been suggested 
*do* work.

Guy

Leigh Sharpe wrote:
> Thanks for all the suggestions, guys, but it looks like it's a browser 
> bug. This makes interesting reading, for those who care enough:
>  
> http://ppewww.ph.gla.ac.uk/~flavell/www/content-type.html 
> <http://ppewww.ph.gla.ac.uk/%7Eflavell/www/content-type.html>
>  
>  
> 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:* Leigh Sharpe
> *Sent:* Monday, June 19, 2006 4:50 PM
> *To:* melbourne-pm
> *Subject:* [Melbourne-pm] Delivering PDFs via CGI
>
> 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/5f708373/attachment.html 


More information about the Melbourne-pm mailing list