-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
352 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
DO NOT EDIT THE CONFIG FILES DIRECTLY IN THIS DIRECTORY! | ||
-------------------------------------------------------- | ||
|
||
Copy the dist file into your `./config/autoload` directory. Remove the .dist part. | ||
|
||
Or you can copy it content into your `./module/MyExampleModule/config/module.config.php` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
/** | ||
* ZffHtml2Pdf Configuration | ||
* | ||
* If you have a ./config/autoload/ directory set up for your project, you can | ||
* drop this config file in it and change the values as you wish. | ||
*/ | ||
return [ | ||
'zff-html2pdf' => [ | ||
//default factory options | ||
'options' => [ | ||
'orientation' => 'P', | ||
'format' => 'A4', | ||
'lang' => 'en', | ||
'unicode' => true, | ||
'encoding' => 'UTF-8', | ||
'margins' => [0, 0, 0, 0], | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Configuring html2pdf constructor | ||
|
||
Optionally, you can change the default values for html2pdf | ||
constructor by adding this configuration to your `./config/autoload/global.php`. | ||
|
||
```php | ||
<?php | ||
return [ | ||
'zff-html2pdf' => [ | ||
//HTML2PDF factory options | ||
'options' => [ | ||
'orientation' => 'P', | ||
'format' => 'A4', | ||
'lang' => 'en', | ||
'unicode' => true, | ||
'encoding' => 'UTF-8', | ||
'margins' => [0, 0, 0, 0], | ||
], | ||
], | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Examples | ||
|
||
## Coming Soon | ||
|
||
We gonna create here a full list of example written for ZF2. | ||
|
||
For now, check for examples and HTML / CSS support at [html2pdf.fr](http://html2pdf.fr/) and [github.com/spipu/html2pdf](https://github.com/spipu/html2pdf). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div class="container"> | ||
<div class="jumbotron"> | ||
<h1>zff-html2pdf</h1> | ||
|
||
<p>Zff\Html2Pdf module integrates <a href="https://github.com/spipu/html2pdf">spipu/html2pdf</a> with Zend Framework</p> | ||
|
||
<pre><code class="language-bash">$ composer require fagundes/zff-html2pdf:0.*</code></pre> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Quick Start | ||
|
||
The Zff Html2pdf is a simple wrapper to easily integrates the [spipu/html2pdf](https://github.com/spipu/html2pdf) library to Zend Framework. | ||
It creates a Html2PdfStrategy to get a ordinary `.phtml` template and returns it as a `.pdf` file. | ||
|
||
## 1. Install Zff\Html2pdf | ||
|
||
|
||
Installation of this module uses composer. For composer documentation, please refer to | ||
[getcomposer.org](http://getcomposer.org/). | ||
|
||
```bash | ||
php composer.phar require fagundes/zff-html2pdf:0.* | ||
``` | ||
|
||
Then add `Zff\\Html2Pdf` to your `config/application.config.php`. | ||
|
||
Installation without composer is not officially supported and requires you to manually install all dependencies that are listed in composer.json | ||
|
||
## 2. Usage | ||
|
||
### 2.1. Ready to Go | ||
|
||
This module comes ready to go. You need to return a `Html2PdfModel` in your controller action, instead of a `ViewModel` or an `array`. | ||
And create your view template `.phtml` for that action. And that's it, your view will be rendered as a `.pdf` file! | ||
|
||
### 2.2. Simple Example | ||
|
||
Controller: `AnyController.php` | ||
|
||
```php | ||
<?php | ||
|
||
use Zff\Html2Pdf\View\Model\Html2PdfModel; | ||
`Html2PdfModel | ||
class AnyController | ||
{ | ||
|
||
public function someAction() | ||
{ | ||
//some logic here | ||
|
||
return new Html2PdfModel([ | ||
'foo' => $foo, | ||
'bar' => $bar | ||
]); | ||
} | ||
|
||
} | ||
``` | ||
|
||
View: `some.phtml` | ||
|
||
```php | ||
<!-- Regular HTML --> | ||
<div class="container"> | ||
<h2>The header</h2> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eu metus sed lacus ultrices pharetra a vitae massa. | ||
</p> | ||
</div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
docs_dir: doc/book | ||
site_dir: doc/html | ||
pages: | ||
- index.md | ||
- 'Quick Start': quick-start.md | ||
- Reference: | ||
- 'Configuring the html2pdf constructor': configuring.md | ||
- Examples: examples.md | ||
- Contribuing: contribuing.md | ||
site_name: Zff\Html2pdf | ||
site_description: 'Zff\Html2pdf : Module for Zend Framework' | ||
repo_url: 'https://github.com/fagundes/zff-html2pdf' | ||
copyright: 'Copyright (c) 2016 <a href="http://www.viniciusfagundes.com/">Vinícius Fagundes</a>' |
Oops, something went wrong.