Download the PHP package daoandco/cakephp-dompdf without Composer
On this page you can find all versions of the php package daoandco/cakephp-dompdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cakephp-dompdf
Dompdf plugin for CakePHP
Requirements
- PHP version 5.4.16 or higher
- CakePhp 3.0 or higher
- Dompdf 0.7
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
After installation, generate symlink for CSS (http://book.cakephp.org/3.0/en/deployment.html#symlink-assets)
Quick Start
Loading the Plugin
Activate pdf extension (http://book.cakephp.org/3.0/en/development/routing.html#routing-file-extensions)
Loading component RequestHandler
In a controller
Create a view (pdf content)
Show the pdf in your browser : http://dev.local/myproject/yop/view/test.pdf
Configuration
Use $this->viewBuilder()
with :
-
->className() : set the view classname http://api.cakephp.org/3.1/class-Cake.View.ViewBuilder.html#_className Use the plugin view by default
className('Dompdf.Pdf')
-
->layout() : set the name of the layout file to render the view http://api.cakephp.org/3.1/class-Cake.View.ViewBuilder.html#_layout Use the plugin layout by default
layout('Dompdf.default')
- ->options() : Set additional options for the view
http://api.cakephp.org/3.1/class-Cake.View.ViewBuilder.html#_options
Use array with key
config
and valuearray
with dompdf config- filename : pdf name
- upload_filename : path with filename for upload render
- render : (see render )
- browser : show in browser
- download : download the pdf by browser
- upload : save file on the server
- stream : return a stream resource for sending file without save
- size : paper size : default
A4
- orientation : paper orientation (
portait
ORlandscape
) : defaultportrait
- dpi : Image DPI setting : default
192
- isRemoteEnabled : Enable remote file access : default
true
- paginate: activate pagination (array) : default
false
(see paginate ) - More options : see dompdf documention https://github.com/dompdf/dompdf/wiki
View
Header
with default layout and dompdf.css
Footer
with default layout and dompdf.css
Image
use Helper
Exemple :
CSS stylesheets
use Helper
Exemple :
Page break
with dompdf.css
Render
Display on browser
Force download on browser
Upload on server
Stream
Paginate
With helper
You can show page number but not number of pages
With PdfView
You can show page number and number of pages Use paginate key in view config
Paginate options :
- x : left position : default
0
- y : top position : default
0
- font : font family : default
null
- size : font size : default
12
- text : default
"{PAGE_NUM} / {PAGE_COUNT}"
- color : rgb (array) : default
[0,0,0]
= black