A PHP wrapper around Libreoffice for converting documents from one format to another.

Overview

Document Converter

A PHP wrapper around Libreoffice for converting documents from one format to another.

For example:

  • Microsoft Word to PDF
  • OpenOffice to Microsoft Word
  • PDF to HTML
  • ...and many more

Installation

IMPORTANT: You must have Libreoffice installed.

Using composer:

composer require lukaswhite/document-converter

Usage

use Lukaswhite\DocumentConverter\Converter;

$converter = new Converter('/path/to/document.doc');
$converter->toPDF();

All being well, this should create a file named document.pdf in the same folder.

To customize the filename:

$converter->outputAs('converted')->toPDF();

...or the output path:

$converter->outputTo('/path/to/converted/files')->toPDF();

You can of course combine these:

$converter->outputAs('converted')
    ->outputTo('/path/to/converted/files')
    ->toPDF();

For other formats:

$converter->toFormat('doc');

Return Format

The conversion method returns an object that contains information about the conversion:

$result = $converter->toPDF();

$result->getFilepath(); // e.g. /path/to/document.pdf
$result->getFilename(); // e.g. document.pdf
$result->getExtension(); // e.g. pdf
You might also like...
PocketMine-MP Plugin for converting items & blocks name to your language.
PocketMine-MP Plugin for converting items & blocks name to your language.

ConvertName PocketMine-MP Plugin for converting items & blocks name to your language. Usage Due to license issue, I don't put the language files direc

laminas-xml2json provides functionality for converting XML structures to JSON

laminas-xml2json This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Stee

Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance.

Nextcloud All In One Beta This is beta software and not production ready. But feel free to use it at your own risk! We expect there to be rough edges

A pure PHP library for reading and writing presentations documents
A pure PHP library for reading and writing presentations documents

Branch Master : Branch Develop : PHPPresentation is a library written in pure PHP that provides a set of classes to write to different presentation fi

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

Skosmos is a web-based tool providing services for accessing controlled vocabularies, which are used by indexers describing documents and searchers looking for suitable keywords.

Skosmos is a web-based tool providing services for accessing controlled vocabularies, which are used by indexers describing documents and searchers looking for suitable keywords.

Algerian code generator for invoices, quotes or any commercial documents

Algerian invoice code generator The library is useful to generate code for invoices, quotes or any commercial transaction document. Goal Is to provide

Json-normalizer: Provides generic and vendor-specific normalizers for normalizing JSON documents

json-normalizer Provides generic and vendor-specific normalizers for normalizing JSON documents. Installation Run $ composer require ergebnis/json-nor

A school platform to organize documents and files for students manged by teachers also user role management
A school platform to organize documents and files for students manged by teachers also user role management

A school platform to organize documents and files for students manged by teachers also user role management. The app is developed by the LARAVEL Framework.

Owner
Lukas White
Lukas White
Another initiative where patient in need of Blood and recovered patients willing to donate Blood can come together under one platform and connect with each other.

This is yet another initiative where patient in need of Blood and recovered patients willing to donate Blood can come together under one platform and connect with each other.

Rohit Tiwari 1 May 5, 2022
An object oriented wrapper around PHP's built-in server.

Statix Server Requirements PHP 8 minumum Installation composer require statix/server Basic Usage To get started, ensure the vendor autoload script is

Statix PHP 113 Dec 27, 2022
A simple wrapper around vlucas' PHP dotenv library for Kirby CMS.

kirby-phpdotenv A simple wrapper around vlucas' PHP dotenv library for Kirby CMS. Why? I've been using .env in my Kirby projects for a while, but I go

Steve Jamesson 5 Feb 6, 2020
WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate is simply a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate 1.7k Dec 24, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 845 Dec 13, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 836 Jan 26, 2022
A wrapper around faker for factory muffin

Factory Muffin Faker 2.3 The goal of this package is to wrap Faker to make it super easy to use with Factory Muffin. Note that this library does not a

The League of Extraordinary Packages 36 Nov 29, 2022
A wrapper around symplify/config-transformer used to update recipes and using easy coding standard for generating readable config files.

Symfony Recipes Yaml to PHP Converter This is a wrapper around the symplify/config-transformer used to convert Symfony core recipes which uses .yaml c

Alexander Schranz 3 Nov 24, 2022
Php library for converting emoji shortcodes to emoji

Emojify provides methods for checking if string is shortcode replace shortcode with emoji replacing all shortcodes in string with emoji Made for a md

Neo Lejondahl 2 Oct 3, 2022
PHP Japanese string helper functions for converting Japanese strings from full-width to half-width and reverse. Laravel Rule for validation Japanese string only full-width or only half-width.

Japanese String Helpers PHP Japanese string helper functions for converting Japanese strings from full-width to half-width and reverse. Laravel Rule f

Deha 54 Mar 22, 2022