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 data as text/html; charset=utf-8 text/html; charset=utf-8 . I also tried
$this->response->header(array('Content-Type' => 'application/x-pdf'));
But he still sent it as text/html . How can I get the response to be sent using the above content type?
Lanbo source share