krona / wkhtml-module
ZF2 Module for Wkhtmltopdf
dev-master
2015-02-05 15:41 UTC
Requires
- h4cc/wkhtmltopdf-amd64: dev-master
- krona/common-module: dev-master
- zendframework/zend-view: >=2.1.0,<2.5-dev
Requires (Dev)
- phpunit/phpunit: 4.2
- zendframework/zendframework: >=2.1.0,<2.5-dev
This package is auto-updated.
Last update: 2024-11-09 14:23:49 UTC
README
Krona WKHTML is an ZF2 Module for simplify working with PDF generation
Install
Composer
Install Composer Composer:
$ curl -s https://getcomposer.org/installer | php
Add requirements to composer.json
:
{
"require": {
"krona/wkhtml-module": "dev-master"
}
}
Configuration
In your application config add module:
<?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:
'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:
'krona' => [
'wkhtml' => [
'dir' => 'public/placement/',
'base_url' => 'http://my.domain/placement/'
],
],
Usage
Simple use with sending PDF to user
class SomeController extends AbstractController
{
public function testAction()
{
//...
$view = new PdfModel( //The same as ViewModel
[
]
);
$view->setOrientation(PdfModel::ORIENTATION_LANDSCAPE);
return $view;
}
}