breadlesscode/office-converter

Convert office documents to something else

v1.0.2 2018-01-03 14:02 UTC

This package is auto-updated.

Last update: 2024-10-30 01:53:41 UTC


README

Latest Stable Version Downloads License

This package is for converting office formats to something else. You can generate Thumbnails, PDFs etc..

Requirements

Which extension can be converted to what?

You can check the following files:

Installation

This package can be installed through Composer.

composer require breadlesscode/office-converter

How to use

use \Breadlesscode\Office\Converter;

Converter::file('Test.odt') // select a file for convertion
    ->setLibreofficeBinaryPath('/usr/bin/libreoffice') // binary to the libreoffice binary
    ->setTemporaryPath('./temp') // temporary directory for convertion
    ->setTimeout(100) // libreoffice process timeout
    ->save(__DIR__.'/lorem.pdf'); // save as pdf

Examples

Save with original name in folder

use Breadlesscode\Office\Converter;

Converter::file('./Test.odt')
    ->save('./lorem', 'jpg');

Save with custom name

use Breadlesscode\Office\Converter;

Converter::file('./Test.odt')
    ->save('./lorem.jpg');

Testing

$ composer test

License

The MIT License (MIT). Please see License File for more information.