FriendsOfCake/CakePdf

CakePdf not showing any data any error

roshanapptec opened this issue · 4 comments

I am using CakePdf plugin to create pdf files from Html. I've installed plugin using composer and install it in bootstrap.php. Bootstrap.php

Plugin::load('CakePdf',['bootstrap' => true]);

Configure::write('CakePdf', [ 'engine' => 'CakePdf.WkHtmlToPdf', 'margin' => [ 'bottom' => 15, 'left' => 50, 'right' => 30, 'top' => 45 ], 'orientation' => 'landscape', 'download' => true ]);
Also extension is loaded in routes.php

Router::extensions('json', 'xml', 'pdf');
RequestHandler is also enabled in AppController and I've also use it in my controller. And I've used one method which I want to convert to pdf. Code in controller.

public function generatePdf() {

$billNumber = "100004";
$bill = $this->Bills->find("all")
    ->contain(['Users', 'Customers', 'PaymentGateways'])
    ->where(['bill_number' => $billNumber]);
$billDetails = $this->Bills->BillDetails->find('all')
    ->where(['bill_id' => $billNumber]);
$this->set(compact('bill', 'billDetails', 'billNumber'));

$this->viewBuilder()->options([
    'pdfConfig' => [
        'download' => true,
        'filename' => 'Invoice.pdf'
    ]
]);

}
And also view is created where output is rendered. generate_pdf.ctp:

Banana

Boom !!!

But when I am accessing my method nothing happening in browser. Only my content is showing and no error or warning is showing

I am experiencing the same situation.

What version of Cake are you using?

In my case debug info was disabled at multiple places. When I enabled it, some parent views were missing.

ADmad commented

Please use one of Cake's help forums to sort out your issue.