Download the PHP package michaeld555/pdf-converter without Composer
On this page you can find all versions of the php package michaeld555/pdf-converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download michaeld555/pdf-converter
More information about michaeld555/pdf-converter
Files in michaeld555/pdf-converter
Package pdf-converter
Short Description A simple manager conversion for docx files to pdf
License MIT
Homepage https://github.com/michaeld555/pdf-converter
Informations about the package pdf-converter
PDF Converter
PHP library to convert DOCX files to PDF using a local LibreOffice installation. Conversions run headless with isolated profiles and temporary directories, enabling concurrent executions with minimal conflict.
Requirements
PHP
- PHP 8.2 or higher.
- Composer 2.
proc_openenabled (used bysymfony/process).
LibreOffice
The libreoffice or soffice binary must be installed on the system:
On Windows, install LibreOffice and configure the full path to soffice.exe.
Installation
Quick start
Existing files are not overwritten by default.
Configuration
Driver options
| Option | Type | Default | Description |
|---|---|---|---|
binary |
string |
libreoffice |
Binary name or path. |
timeout |
float |
60.0 |
Max conversion time in seconds. |
overwrite |
bool |
false |
Allow overwriting an existing PDF. |
processRunner |
?ProcessRunner |
Symfony Runner | Advanced integration or testing. |
temporaryDirectory |
?string |
System temp | Base directory for isolated files. |
Error handling
All failures throw Michaeld555\PdfConverter\Exception\ConversionException:
Checked scenarios include missing/invalid source or destination, timeout, missing LibreOffice, process errors, and invalid PDF output.
API reference
Michaeld555\PdfConverter\Converter
Main facade. Uses LibreOfficeConverter when no driver is provided.
Michaeld555\PdfConverter\Driver\LibreOfficeConverter
Path rules
- Source must be a local, readable
.docxfile (no URLs). - Destination must end in
.pdf; its parent directory must exist and be writable. - Directories are not created automatically.
Custom drivers
Implement DocumentConverter to integrate other mechanisms (Microsoft Graph,
internal queue, etc.):
Docker
Testing & quality
Integration tests require LibreOffice, pdfinfo (poppler-utils), and the ZIP
extension. Use LIBREOFFICE_BINARY env var to set a custom binary for tests.
Troubleshooting
- LibreOffice not found: Verify
proc_openis enabled and set thebinarypath. - Timeout: Increase
timeoutfor large documents or slow storage. - Wrong fonts: Install the document fonts and run
fc-cache -f. - Permission denied: Check read/write access for origin, destination, and temp directories under the PHP process user.
- File exists: Enable
overwrite: trueor choose another destination.
Security
- No documents are sent to third parties.
- No URL downloading; all input must be local.
- Process arguments use a list (no shell command injection).
- Output is validated to start with
%PDF-before saving. - Temporary files use random names with restricted permissions.
Migration from 1.x
| Before | After |
|---|---|
Converter::docx_to_pdf() static method |
(new Converter())->convert() instance method |
| PHP 8.0 minimum | PHP 8.2 minimum |
| Remote URLs accepted | Local files only |
| Destination could be a directory | Full path with .pdf required |
| Overwrite by default | Explicit overwrite: true required |
| FPDI, TCPDF, Office endpoint | Removed |
The legacy Michaeld555\Converter::docx_to_pdf() adapter is available for gradual
migration but is deprecated.
Project structure
License
MIT. See LICENSE.