In my controller action, I have this:
$pdf = $this->Invoice->makePdf($invoice);
$this->response->charset('UTF-8');
$this->response->body($pdf);
$this->response->type(array('pdf' => 'application/x-pdf'));
$this->response->disableCache();
$this->response->send();
However, no matter what I do, CakePHP always sends the data as text/html; charset=utf-8
. I have also tried
$this->response->header(array('Content-Type' => 'application/x-pdf'));
But it still sent it as text/html
. How can I force the response to be sent using the content type above?