No description, website, or topics provided.
Clone or download
romainneutron Merge pull request #2 from bitdeli-chef/master
Add a Bitdeli Badge to README
Latest commit a8000b8 Aug 14, 2013
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Add documentation Apr 16, 2012
src/Unoconv Remove call to logger Jun 25, 2013
tests Fix unit tests Jul 3, 2013
.gitignore Update gitignore Sep 3, 2012
.travis.yml Add functional tests Apr 26, 2013
CHANGELOG.md Prepare version 0.3.0 Jun 25, 2013
LICENSE Add missing license file Apr 26, 2013
README.md Add a Bitdeli badge to README Aug 14, 2013
composer.json Version 0.3 Jun 25, 2013
composer.lock Version 0.3 Jun 25, 2013
phpunit-functional.xml.dist Add functional tests Apr 26, 2013
phpunit.xml.dist Add functional tests Apr 26, 2013

README.md

PHP Unoconv

Build Status

An Object Oriented library which allow easy to use file conversion with Unoconv.

Install

The recommended way to install PHP-Unoconv is through composer.

{
    "require": {
        "php-unoconv/php-unoconv": "~0.2"
    }
}

Documentation

Documentation available at http://php-unoconv.readthedocs.org/

API Usage

To instantiate Unoconv driver, the easiest way is :

$unoconv = Unoconv\Unoconv::create();

You can customize your driver by passing a Psr\Log\LoggerInterface or configuration options.

Available options are :

  • timeout : the timeout for the underlying process.
  • unoconv.binaries : the path (or an array of paths) for a custom binary.
$unoconv = Unoconv\Unoconv::create(array(
    'timeout'          => 42,
    'unoconv.binaries' => '/opt/local/unoconv/bin/unoconv',
), $logger);

To transcode a file, use the transcode method. For the complete format list supported by unoconv, refer to the unoconv CLI.

$unoconv->transcode('document.docx', 'pdf', 'document.pdf');

You can optionaly transcode a given page range using the fourth argument :

// pages 1 to 14
$unoconv->transcode('document.docx', 'pdf', 'document.pdf', '1-14');

Silex Service Provider

A Silex Service Provider is available, all parameters are optionals :

$app = new Silex\Application();
$app->register(new Unoconv\UnoconvServiceProvider(), array(
    'unoconv.configuration' => array(
        'unoconv.binaries' => '/opt/local/unoconv/bin/unoconv',
        'timeout'          => 42,
    ),
    'unoconv.logger'  => $app->share(function () {
        return $app['monolog']; // use Monolog service provider
    }),
));

License

Released under the MIT license

Bitdeli Badge