I need to serve pdf files through the controller, but I can't make them open in browser window. When I send response with pdf file, it renders gibberish, or if I follow example at http://symfony.com/doc/current/components/http_foundation/introduction.html#serving-files it downloads the file, but I need to open it in view mode, how can I do that?
Here's what I'v got so far:
return new Response(readfile('/file/path/file.pdf'), 200,
array('Content-Type' => 'application/pdf')
);
Am I missing something, or maybe there's something wrong with my php or apache configuration?
Content-Disposition: inline; filename.pdfHeader.