1. Go to this page and download the library: Download petecoop/odt library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
petecoop / odt example snippets
use Petecoop\ODT\Facades\ODT;
ODT::open(resource_path("file.odt"))
->render([
"some" => "arguments",
]);
ODT::officeBinary('/path/to/soffice')
->open(resource_path("file.odt"));
// if using ODT::make()
ODT::make('/path/to/soffice')
->open(__DIR__ . "/templates/file.odt");
$odt = ODT::open(resource_path("file.odt"))
->render([
"some" => "arguments",
]);
// Save ODT file
$odt->save(storage_path("file.odt"));
// Convert to PDF and save
$pdf = $odt->pdf()->save(storage_path("file.pdf"));
// Return as download response in a Laravel Controller
return $pdf;
blade
@rowforeach($users as $user)
{{ $user->name }}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.