in reply to Re: How to create a pdf download link using Mason?
in thread How to create a pdf download link using Mason?

Thanks for your reply. But just change the content-type is not worked. It ask to download the file, but when we try to open it in adobe reader, it shows error message as it is not a supported format. I think its because we are trying to open a text file using adobe.

Below is the code I tried.

<%init>
$r->content_type('application/pdf');
$r->headers_out->{'Content-disposition'} = "attachment; filename=report.pdf";
$m->print('test');
</%init>
  • Comment on Re^2: How to create a pdf download link using Mason?

Replies are listed 'Best First'.
Re^3: How to create a pdf download link using Mason?
by marto (Cardinal) on Jun 08, 2012 at 11:40 UTC

    'test' isn't a valid PDF file. If you are actually trying to serve a PDF file, open it and send the content appropriately. If you simply think you can send any text and have Adobe PDF reader open it as a PDF file, you're mistaken. In that case you'd need to create a PDF then serve it.