The problem is that AppShell
doesn't support view functional by default. So like in similar question, you have to add following:
App::uses('View', 'Core');
$view = new View();
$view->set(compact('data', 'cmsoptions'));
$view->layout = 'pdf';
$pdfContent = $view->render();
And then you can use $pdfContent
as content of PDF file with help of file_put_contents('/var/www/new_invoice.pdf', $pdfContent);
or similar.