Your statement to set the response headers is slightly malformed:
$this->getResponse()
->setHeader('Content-Disposition', 'inline; filename=result.pdf')
->setHeader('Content-type', 'application/x-pdf');
The above should work - please note the difference in the Content-Disposition
-header.
By the way... When you want to force a download box (instead of loading the document in the browser) you should use the Content-Disposition
attachment
.
$this->getResponse()
->setHeader('Content-Disposition', 'attachment; filename=result.pdf')
->setHeader('Content-type', 'application/x-pdf');
Depending on the browser it may be possible that you also have to set the Content-Length
or change the Content-type
to a combination (multiple headers) of one or more of application/force-download
, application/octet-stream
and/or application/download
. And as I wrote in the comment sometimes caching headers may interfere with your download. Check to see which caching-headers are sent.