dev-master
9999999-devZF2 Module for Wkhtmltopdf
MIT
The Requires
- krona/common-module dev-master
- zendframework/zend-view >=2.1.0,<2.5-dev
- h4cc/wkhtmltopdf-amd64 dev-master
The Development Requires
by Alex Grand
Wallogit.com
2017 © Pedro Peláez
ZF2 Module for Wkhtmltopdf
Krona WKHTML is an ZF2 Module for simplify working with PDF generation, (*1)
Install Composer Composer:, (*2)
$ curl -s https://getcomposer.org/installer | php
Add requirements to composer.json:, (*3)
{
"require": {
"krona/wkhtml-module": "dev-master"
}
}
In your application config add module:, (*4)
<?php
return [
// This should be an array of module namespaces used in the application.
'modules' => [
'Krona\CommonModule',
'Krona\WKHTML',
...
],
...
],
If you want to use lib with ability to send PDF directly to user from Action register Strategy inside global config:, (*5)
'view_manager' => [
'strategies' => [
\Krona\WKHTML\Strategy\PdfStrategy::class,
],
],
Also you need to add config for placement and base URL for temporary location of HTML for example:, (*6)
'krona' => [
'wkhtml' => [
'dir' => 'public/placement/',
'base_url' => 'http://my.domain/placement/'
],
],
class SomeController extends AbstractController
{
public function testAction()
{
//...
$view = new PdfModel( //The same as ViewModel
[
]
);
$view->setOrientation(PdfModel::ORIENTATION_LANDSCAPE);
return $view;
}
}
ZF2 Module for Wkhtmltopdf
MIT