# Laravel PDF: mPDF wrapper for Laravel 5 > Easily generate PDF documents from HTML right inside of Laravel using this mPDF wrapper. ## Installation Require this package in your `composer.json` or install it by running: ``` composer require catalinbozianu/laravel-pdf ``` To start using Laravel, add the Service Provider and the Facade to your `config/app.php`: ```php 'providers' => [ // ... catalinbozianu\LaravelPdf\PdfServiceProvider::class ] ``` ```php 'aliases' => [ // ... 'PDF' => catalinbozianu\LaravelPdf\Facades\Pdf::class ] ``` ## 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`. ```php use PDF; function generate_pdf() { $data = [ 'foo' => 'bar' ]; $pdf = PDF::loadView('pdf.document', $data); return $pdf->stream('document.pdf'); } ``` ## Config You can use a custom file to overwrite the default configuration. Just create `config/pdf.php` and add this: ```php '', 'format' => 'A4', 'defaultFontSize' => '12', 'defaultFont' => 'sans-serif', 'marginLeft' => 10, 'marginRight' => 10, 'marginTop' => 10, 'marginBottom' => 10, 'marginHeader' => 0, 'marginFooter' => 0, 'orientation' => 'P', 'title' => 'Laravel PDF', 'author' => '', 'watermark' => '', 'showWatermark' => false, 'watermarkFont' => 'sans-serif', 'SetDisplayMode' => 'fullpage', 'watermarkTextAlpha' => 0.1 ]; ``` ## Headers and Footers If you want to have headers and footers that appear on every page, add them to your `
` tag like this: ```html