Render .odt files with Blade, convert to pdf with Libre/OpenOffice

0.3.1 2023-09-21 13:25 UTC

This package is auto-updated.

Last update: 2024-11-21 15:50:44 UTC


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