in reply to Outputting PDF via CGI
perldoc CGI says...
print $q->header(-type=>'image/gif',-expires=>'+3d'); [download]
So... try:
print header(-type=>'application/pdf'),$buffer; [download]
If you're on a Winbloze box you might need to binmode the PDF file.