mitch26
February 22, 2017, 12:12pm
1
Hello,
is it possible that floating in CakePdf doesn’t work?
I want to create this:
<div style="float: right;">
<img src="img/logo.png" />
</div>
but it doesn’t work (the div doesn’t move).
On the other hand something like this work:
style="width:600px;
What is the problem?
Thanks for help
Mitch
dakota
February 22, 2017, 1:01pm
2
It depends on the rendering engine that you are using. WkHTMLToPDF supports floats (Since it uses the webkit rendering engine in the background), but the others do not support it.
mitch26
February 22, 2017, 2:39pm
3
thanks fot the answer,
I put the code in the bootstrap:
Configure::write('CakePdf', array(
'engine' => 'CakePdf.WkHtmlToPdf',
'orientation' => 'portrait',
'download' => true
));
and in \Plugin\CakePdf\Pdf\Engine is the WkHtmlToPdfEngine.php.
but it doesn’t work.
How can i see which engine is loaded?
mitch26
February 23, 2017, 2:04pm
4
update:
i have to write the path for the WkHtmlToPdf.exe in Configure like that:
‘binary’ => ‘files/wkhtmltopdf.exe’
Now the file is discover.
But now i get the message:
WKHTMLTOPDF didn’t return any data
If i change the engine to: 'CakePdf.DomPdf_ it works, but without the floating.
Why there are no any data?
dakota
February 26, 2017, 2:42pm
5
What happens if you run wkhtmltopdf manually in command prompt?
mitch26
February 28, 2017, 8:32am
6
Good morning dakota,
i get the message
Uncaught ReferenceError: wkhtmltopdf is not defined
at :1:1
Thats the output from StackTrace:
Stack Trace
APP\Plugin\CakePdf\Pdf\CakePdf.php line 236 → WkHtmlToPdfEngine->output()
}
}
$output = $Engine->output();
APP\Plugin\CakePdf\View\PdfView.php line 97 → CakePdf->output(string)
$this->response->download($this->getFilename());
}
$this->Blocks->set('content', $this->renderer()->output($content));
return $this->Blocks->get('content');
CORE\Cake\Controller\Controller.php line 963 → PdfView->render(null, null)
}
$this->autoRender = false;
$this->response->body($this->View->render($view, $layout));
return $this->response;
CORE\Cake\Routing\Dispatcher.php line 200 → Controller->render()
}
if ($render && $controller->autoRender) {
$response = $controller->render();
} elseif (!($result instanceof CakeResponse) && $response->body() === null) {
CORE\Cake\Routing\Dispatcher.php line 167 → Dispatcher->_invoke(PropertiesController, CakeRequest)
));
}
$response = $this->_invoke($controller, $request);
if (isset($request->params['return'])) {
APP\webroot\index.php line 111 → Dispatcher->dispatch(CakeRequest, CakeResponse)
$Dispatcher->dispatch(
new CakeRequest(),
new CakeResponse()
);