Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikemix/dompdfmodule
DOMPDF as lightweight ZF2 module
https://github.com/mikemix/dompdfmodule
Last synced: 3 months ago
JSON representation
DOMPDF as lightweight ZF2 module
- Host: GitHub
- URL: https://github.com/mikemix/dompdfmodule
- Owner: mikemix
- Created: 2014-11-03T10:10:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-25T11:07:34.000Z (about 2 years ago)
- Last Synced: 2024-10-08T21:18:01.847Z (4 months ago)
- Language: PHP
- Size: 31.3 KB
- Stars: 0
- Watchers: 0
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
dompdfmodule
============DOMPDF library wrapper as lightweight ZF2/ZF3 module.
[![Build Status](https://travis-ci.org/mikemix/dompdfmodule.svg?branch=master)](https://travis-ci.org/mikemix/dompdfmodule)
## Requirements
- [Zend Framework 2 or 3](https://framework.zend.com/)## Installation
Installation of DOMPDFModule uses PHP Composer. For more information about
PHP Composer, please visit the official [PHP Composer site](http://getcomposer.org/).#### Installation steps
1. `cd my/project/directory`
2. create a `composer.json` file with following contents:```json
{
"require": {
"mikemix/dompdfmodule": "^3.0"
}
}
```
3. install PHP Composer via `curl -s http://getcomposer.org/installer | php` (on windows, download
http://getcomposer.org/installer and execute it with PHP)
4. run `php composer.phar install`
5. open `my/project/directory/config/application.config.php` and add the following key to your `modules`:```php
'dompdfmodule',
```#### Configuration options
You can override default options via the `dompdf` key in your local or global config files. See the [dompdfmoule\Service\dompdfFactory.php](https://github.com/mikemix/dompdfmodule/blob/master/src/dompdfmodule/Service/dompdfFactory.php#L39) file for the list of default settings.Full list of possible settings is available at the official [DOMPDF library](https://github.com/dompdf/dompdf) site.
#### Example usage
> Side note: use of `getServiceLocator()` in the controller is deprecated since in ZF3. Make sure you create your controller via a factory and inject the Dompdf object in the constructor.
```php
getServiceLocator()->get('dompdf');
$dompdf->load_html('Ehlo World');
$dompdf->render();file_put_contents(__DIR__ . '/document.pdf', $dompdf->output());
}
```