PK &%Z;7Vi i laravel-dompdf/readme.mdnu [ ## DOMPDF Wrapper for Laravel
### Laravel wrapper for [Dompdf HTML to PDF Converter](https://github.com/dompdf/dompdf)
[](https://github.com/barryvdh/laravel-dompdf/actions)
[](http://choosealicense.com/licenses/mit/)
[](https://packagist.org/packages/barryvdh/laravel-dompdf)
[](https://packagist.org/packages/barryvdh/laravel-dompdf)
[](https://fruitcake.nl/)
## Installation
### Laravel
Require this package in your composer.json and update composer. This will download the package and the dompdf + fontlib libraries also.
composer require barryvdh/laravel-dompdf
### Lumen
After updating composer add the following lines to register provider in `bootstrap/app.php`
```
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
```
To change the configuration, copy the config file to your config folder and enable it in `bootstrap/app.php`:
```
$app->configure('dompdf');
```
## Using
You can create a new DOMPDF instance and load a HTML string, file or view name. You can save it to a file, or stream (show in browser) or download.
```php
use Barryvdh\DomPDF\Facade\Pdf;
$pdf = Pdf::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');
```
or use the App container:
```php
$pdf = App::make('dompdf.wrapper');
$pdf->loadHTML('
Test
');
return $pdf->stream();
```
Or use the facade:
You can chain the methods:
```php
return Pdf::loadFile(public_path().'/myfile.html')->save('/path-to/my_stored_file.pdf')->stream('download.pdf');
```
You can change the orientation and paper size, and hide or show errors (by default, errors are shown when debug is on)
```php
Pdf::loadHTML($html)->setPaper('a4', 'landscape')->setWarnings(false)->save('myfile.pdf')
```
If you need the output as a string, you can get the rendered PDF with the output() function, so you can save/output it yourself.
Use `php artisan vendor:publish` to create a config file located at `config/dompdf.php` which will allow you to define local configurations to change some settings (default paper etc).
You can also use your ConfigProvider to set certain keys.
### Configuration
The defaults configuration settings are set in `config/dompdf.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:
```shell
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
```
You can still alter the dompdf options in your code before generating the pdf using this command:
```php
Pdf::setOption(['dpi' => 150, 'defaultFont' => 'sans-serif']);
```
Available options and their defaults:
* __rootDir__: "{app_directory}/vendor/dompdf/dompdf"
* __tempDir__: "/tmp" _(available in config/dompdf.php)_
* __fontDir__: "{app_directory}/storage/fonts" _(available in config/dompdf.php)_
* __fontCache__: "{app_directory}/storage/fonts" _(available in config/dompdf.php)_
* __chroot__: "{app_directory}" _(available in config/dompdf.php)_
* __logOutputFile__: "/tmp/log.htm"
* __defaultMediaType__: "screen" _(available in config/dompdf.php)_
* __defaultPaperSize__: "a4" _(available in config/dompdf.php)_
* __defaultFont__: "serif" _(available in config/dompdf.php)_
* __dpi__: 96 _(available in config/dompdf.php)_
* __fontHeightRatio__: 1.1 _(available in config/dompdf.php)_
* __isPhpEnabled__: false _(available in config/dompdf.php)_
* __isRemoteEnabled__: true _(available in config/dompdf.php)_
* __isJavascriptEnabled__: true _(available in config/dompdf.php)_
* __isHtml5ParserEnabled__: false _(available in config/dompdf.php)_
* __isFontSubsettingEnabled__: false _(available in config/dompdf.php)_
* __debugPng__: false
* __debugKeepTemp__: false
* __debugCss__: false
* __debugLayout__: false
* __debugLayoutLines__: true
* __debugLayoutBlocks__: true
* __debugLayoutInline__: true
* __debugLayoutPaddingBox__: true
* __pdfBackend__: "CPDF" _(available in config/dompdf.php)_
* __pdflibLicense__: ""
* __adminUsername__: "user"
* __adminPassword__: "password"
### Tip: UTF-8 support
In your templates, set the UTF-8 Metatag:
### Tip: Page breaks
You can use the CSS `page-break-before`/`page-break-after` properties to create a new page.
Page 1
Page 2
### License
This DOMPDF Wrapper for Laravel is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
PK &%Z laravel-dompdf/composer.jsonnu [ {
"name": "barryvdh/laravel-dompdf",
"description": "A DOMPDF Wrapper for Laravel",
"license": "MIT",
"keywords": ["laravel", "dompdf", "pdf"],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"require": {
"php": "^7.2 || ^8.0",
"dompdf/dompdf": "^2.0.1",
"illuminate/support": "^6|^7|^8|^9|^10"
},
"require-dev": {
"orchestra/testbench": "^4|^5|^6|^7|^8",
"squizlabs/php_codesniffer": "^3.5",
"phpro/grumphp": "^1",
"nunomaduro/larastan": "^1|^2"
},
"autoload": {
"psr-4": {
"Barryvdh\\DomPDF\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Barryvdh\\DomPDF\\Tests\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
},
"laravel": {
"providers": [
"Barryvdh\\DomPDF\\ServiceProvider"
],
"aliases": {
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf",
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf"
}
}
},
"scripts": {
"test": "phpunit",
"check-style": "phpcs -p --standard=psr12 src/",
"fix-style": "phpcbf -p --standard=psr12 src/",
"phpstan": "phpstan analyze --memory-limit=-1"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"allow-plugins": {
"phpro/grumphp": true
}
}
}
PK &%Z laravel-dompdf/CHANGELOG.mdnu [ # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0-beta3]
### Changed
- Remove the deprecated class 'Barryvdh\DomPDF\Facade' Facade in favor of Barryvdh\DomPDF\Facade\Pdf
- Set default Facade to Pdf instead of PDF
## [2.0.0-beta2]
### Added
- Upgraded to use dompdf/dompdf 2.x
- `setOption` to change only the specified option(s), instead of replace all options.
- Magic methods to allow calls to Dompdf methods easier. (#892)
- `default_paper_orientation` option has been added to the defaults.
- Add option to set public path (#890)
### Changed
- HTML5 parser option is deprecated, because this is always on.
- `orientation` option was never used. Removed in favor of `options.default_paper_orientation`
### Deprecated
- `setOptions` is now deprecated. Use `setOption` instead.
- Config `dompdf.defines` has been renamed to `dompdf.options`
## Dompdf 2.0.0, highlights since 1.2.x
> https://github.com/dompdf/dompdf/releases/tag/v2.0.0
> - Addresses multiple security vulnerabilities (see link)
> - Modifies callback and page_script/page_text handling (breaking change, see link)
> - Switches the HTML5 parser to Masterminds/HTML5
> - Improves CSS property parsing and representation
> - Improves border, outline, and background rendering for inline elements
> - Switches installed fonts and font metrics cache file format to JSON
> - Adds support for the inset CSS shorthand property and the legacy break-word keyword for word-break
> - Adds "end_document" callback event
PK &%Z?
&