Download the PHP package zanysoft/laravel-pdf without Composer
On this page you can find all versions of the php package zanysoft/laravel-pdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zanysoft/laravel-pdf
More information about zanysoft/laravel-pdf
Files in zanysoft/laravel-pdf
Package laravel-pdf
Short Description Laravel PDF - for generating pdf invoice or documents with mPDF wrapper.
License MIT
Rated 5.00 based on 1 reviews
Informations about the package laravel-pdf
Laravel PDF: PDF generator for Laravel 5.x | 6.x | 7.x
Easily generate PDF documents from HTML right inside of Laravel using this PDF wrapper.
Contents
- Installation Guide
- Configuration
- Basic Usage
- Headers and Footers
- Included Fonts
- Custom Fonts
- Set Protection
- Documentation
Installation Guide
Require this package in your composer.json
or install it by running:
To start using Laravel, add the Service Provider and the Facade to your config/app.php
:
Configuration
The defaults configuration settings are set in config/pdf.php
. Copy this file to your own config directory to modify the values. You can publish the config using this command:
php artisan vendor:publish --provider="ZanySoft\LaravelPDF\PdfServiceProvider"
Basic Usage
To use Laravel PDF add something like this to one of your controllers. You can pass data to a view in /resources/views
.
or
If you want to generate from html content:
If you want to generate from files:
If you want download pdf file:
If you want to save pdf to server:
If you want add pdf file as attachment to email:
Headers and Footers
If you want to have headers and footers that appear on every page, add them to your <body>
tag like this:
Now you just need to define them with the name attribute in your CSS:
Inside of headers and footers {PAGENO}
can be used to display the page number.
Included Fonts
By default you can use all the fonts shipped with mPDF.
Custom Fonts
You can use your own fonts in the generated PDFs. The TTF files have to be located in one folder, e.g. /resources/fonts/
. Add this to your configuration file (/config/pdf.php
):
And then:
Now you can use the font in CSS:
Set Protection
To set protection, you just call the SetProtection()
method and pass an array with permissions, an user password and an owner password.
The passwords are optional.
There are a few permissions: 'copy'
, 'print'
, 'modify'
, 'annot-forms'
, 'fill-forms'
, 'extract'
, 'assemble'
, 'print-highres'
.
Find more information to SetProtection()
here: https://mpdf.github.io/reference/mpdf-functions/setprotection.html
Documentation
Visit this link for more options and settings: https://mpdf.github.io/