src/View/PdfView.php
public function render($view = null, $layout = null)
    {
        $content = parent::render($view, $layout);

        if (version_compare(Configure::version(), '3.6.0', '<')) {
            $type = $this->response->type();
        } else {
            $type = $this->response->getType();
        }

        if ($type === 'text/html') {
            return $content;
        }
        if ($this->renderer() === null) {
            $this->response = $this->response->withType('html');

            return $content;
        }

        if (!empty($this->pdfConfig['filename']) || !empty($this->pdfConfig['download'])) {
            $this->response = $this->response->withDownload($this->getFilename());
        }

        $this->Blocks->set('content', $this->renderer()->output($content));

        return $this->Blocks->get('content');
    }
public function render($view = null, $layout = null)
    {
        $content = parent::render($view, $layout);

        if (version_compare(Configure::version(), '3.6.0', '<')) {
            $type = $this->response->type();
        } else {
            $type = $this->response->getType();
        }

        if ($type === 'text/html') {
            return $content;
        }
        if ($this->renderer() === null) {
            $this->response = $this->response->withType('html');

            return $content;
        }

        if (!empty($this->pdfConfig['filename']) || !empty($this->pdfConfig['download'])) {
            $this->response = $this->response->withDownload($this->getFilename());
        }

        $this->Blocks->set('content', $this->renderer()->output($content));

        return $this->Blocks->get('content');
    }
public function render ( $ view = null , $ layout = null ) { $ content = parent :: render ( $ view , $ layout ) ; if ( version_compare ( Configure :: version ( ) , '3.6.0' , '<' ) ) { $ type = $ this -> response -> type ( ) ; } else { $ type = $ this -> response -> getType ( ) ; } if ( $ type === 'text/html' ) { return $ content ; } if ( $ this -> renderer ( ) === null ) { $ this -> response = $ this -> response -> withType ( 'html' ) ; return $ content ; } if ( ! empty ( $ this -> pdfConfig [ 'filename' ] ) || ! empty ( $ this -> pdfConfig [ 'download' ] ) ) { $ this -> response = $ this -> response -> withDownload ( $ this -> getFilename ( ) ) ; } $ this -> Blocks -> set ( 'content' , $ this -> renderer ( ) -> output ( $ content ) ) ; return $ this -> Blocks -> get ( 'content' ) ; }
Render a Pdf view.

@param string $view The view being rendered.
@param string $layout The layout being rendered.
@return string The rendered view.
Render a Pdf view .