PHPackages                             midi/document-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. midi/document-converter

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

midi/document-converter
=======================

office documents to pictures / pdf

v1.0.1(3y ago)081MITPHPPHP &gt;=7.0

Since Aug 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/humSuperman/document-converter)[ Packagist](https://packagist.org/packages/midi/document-converter)[ RSS](/packages/midi-document-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Document Converter
==================

[](#document-converter)

### PHP Library for LibreOffice

[](#php-library-for-libreoffice)

#### Convert offices files to PDF or JPG or PNG using LibreOffice

[](#convert-offices-files-to-pdf-or-jpg-or-png-using-libreoffice)

### Supported file types

[](#supported-file-types)

```
pdf
pptx
ppt
docx
doc
wps
dotx
dotm
dot
odt
docm
ddt
xlsx
xls
log
txt
```

### System Library Installation

[](#system-library-installation)

- [中日韩字体下载（CJK Fonts）](https://zh-cn.libreoffice.org/download/fonts/)
- mac

```
brew install ghostscript
brew install ImageMagick
brew install pkg-config
pecl install imagick
brew install libreoffice

```

- centos

```
yum install ghostscript
yum install ImageMagick
yum install pkg-config
pecl install imagick
yum install libreoffice

```

- ubuntu

```
apt-get install ghostscript
apt-get install ImageMagick
apt-get install pkg-config
pecl install imagick
apt-get install libreoffice

```

### Installation

[](#installation)

Run this command within your project directory

```
composer require midi/document-converter
```

### Usage

[](#usage)

Here are some samples.

- pdf converter to image array

```
$service = new DocumentConverter('/tmp/1.pdf');
$service->fileToImage()

// image save dir : /usr/tmp/a/dir
// image save ext : jpg
// image background : green
// image background : green
// read source file resolution : 100
// save image quality : 90
$service = new DocumentConverter('/tmp/1.pdf', '/usr/tmp/a/dir', 'jpg', 'green', 100, 90);
$service->fileToImage()
```

- doc converter to image array

```
$service = new DocumentConverter('/tmp/1.docx');
$service->fileToImage()
```

- doc/ppt converter to image array

```
$service = new DocumentConverter('/tmp/1.pptx');
$pdfPath = $service->fileToPdf()
```

### Method Returns Result

[](#method-returns-result)

- fileToImage

```
[
    'total_page' => 4,
    'success_total' => 3,
    'fail_total' => 1,
    'success_page' => [
        '/tmp/1.jpg',
        '/tmp/2.jpg',
        '/tmp/4.jpg',
    ],
    'success_page' => [
        '/tmp/1.jpg',
        '/tmp/2.jpg',
    ],
    'fail_page' => [
        '/tmp/3.jpg',
    ]
]
```

- fileToPdf

```
'/tmp/a/b/c/d/1.pdf'
```

- Exception

```
DocumentConverterException
```

### License

[](#license)

The OfficeConverter package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

### Feedback &amp; Contribute

[](#feedback--contribute)

Notify me of any issues, bugs, or improvements. Thanks.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1375d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c19ce42521d93e829e50d202af5cbbaa038c4a262d62d943314d98fc510c710?d=identicon)[humSuperman](/maintainers/humSuperman)

---

Top Contributors

[![humSuperman](https://avatars.githubusercontent.com/u/24327082?v=4)](https://github.com/humSuperman "humSuperman (4 commits)")

---

Tags

imageconverterdocumentLibreOfficesoffice

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/midi-document-converter/health.svg)

```
[![Health](https://phpackages.com/badges/midi-document-converter/health.svg)](https://phpackages.com/packages/midi-document-converter)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[spatie/pdf-to-image

Convert a pdf to an image

1.4k15.2M64](/packages/spatie-pdf-to-image)[faisalman/simple-excel-php

Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats

582599.4k1](/packages/faisalman-simple-excel-php)[phpoffice/phppresentation

PHPPresentation - Read, Create and Write Presentations documents in PHP

1.4k2.4M25](/packages/phpoffice-phppresentation)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3685.2M19](/packages/gotenberg-gotenberg-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
