Download the PHP package takeoo/zend-pdf without Composer
On this page you can find all versions of the php package takeoo/zend-pdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package zend-pdf
HTML to PDF for zend framework
Create pdf from view in ZendFramework 3
Works on zend framework v3.*
IF you want to use it with older versions, use one of previous tags
Requirements
-
wkhtmltopdf installed on your server
-
Debian, Ubuntu:
-
*Debian servers have known errors with wkhtmltopdf lib, so if you get error like:
install xvfb:
-
- zend-view 2.3* is installed as dependency
- zend-service-manager is already installed with 3.* version of zf3.
Install
-
Composer install
- Add "Takeoo\Pdf" to 'modules' array in application.config.php
Usage
-
Takeoo\Zend-pdf will create service throughout service manager, so it is available in serviceLocator as 'PdfCreator';
-
Instantiate:
NOTE: PdfCreator is not shared service, so every call to serviceManager will create new instance.
PdfCreator uses ViewResolver which is auto-magically injected to PhpRenderer if have MVC application, so you can use any view or layout you have in your app!
-
Set layout
- Add view as you would in your response, just pass name and variables to createHtml() function
OR you can directly pass already created view model
-
Output
-
All modern browser support pdf output directly to browser:
- get file handle
NOTE: Both above functions will save file to your disk
-
-
Get file path
-
By default all files are generated to your project root into "{Ymd_His}.pdf"
- Change file destination
NOTE: All functions with public scope (with exception of output() and writePdf()) are fluent, so you can chain all functions:
NOTE: By default all wkhtmltopdf conversions are created with setHasXvfb(true), so you have to have installed Xvfb on your server! If you want to turn it of just do:
-