petecoop / odt
Render .odt files with Blade, convert to pdf with Libre/OpenOffice
0.3.1
2023-09-21 13:25 UTC
Requires
- illuminate/view: ^8.0|^9.0
- nelexa/zip: ^4.0
- spatie/temporary-directory: ^1.3|^2.1
- symfony/css-selector: ^5.2|^6.0
- symfony/dom-crawler: ^5.2|^6.0
- symfony/process: ^5.2|^6.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Compile ODT files with Blade.
composer require petecoop/odt
use Petecoop\ODT\Facades\ODT; ODT::open(resource_path('file.odt')) ->render([ 'some' => 'arguments' ]) ->symfonyResponse('file.odt');
Output as PDF
Libreoffice or OpenOffice must be installed and the path to the soffice
binary must be given.
ODT::open(resource_path('file.odt')) ->render([ 'some' => 'arguments' ]) ->saveAsPDF('/tmp/output.pdf', 'path/to/soffice');
Tables
When in Libre/Open Office you can't wrap a @foreach
around a table row - use @beforerow / @endbeforerow
and @afterrow / @endafterrow
@beforerow@foreach ($users as $user)@endbeforerow
{{ $user->name }}
@afterrow@endforeach@endafterrow