Download the PHP package madarlan/pdf-bridge-php without Composer
On this page you can find all versions of the php package madarlan/pdf-bridge-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pdf-bridge-php
PHP PDF Bridge

A powerful and universal PHP/Laravel package for converting various document formats to PDF using multiple converters ( TCPDF, mPDF, LibreOffice). Features robust validation, comprehensive logging, and support for 15+ file formats with Laravel 8-12 support.
Description
PHP PDF Bridge provides a unified interface for document conversion to PDF using several powerful libraries:
- TCPDF - for text, HTML and CSV conversion
- mPDF - for advanced HTML and CSS processing
- LibreOffice (via ncjoes/office-converter) - for DOC/DOCX/XLS/XLSX conversion
Supported Formats
Input formats:
- Text:
.txt, plain text files - HTML:
.html,.htm, HTML markup - CSV:
.csv, tabular data - Microsoft Word:
.doc,.docx - Microsoft Excel:
.xls,.xlsx - Microsoft PowerPoint:
.ppt,.pptx - OpenDocument:
.odt,.ods,.odp - Rich Text:
.rtf
Output format:
- PDF - all conversions produce PDF files
โจ Features
- ๐ Universal conversion: 15+ formats โ PDF (Text, HTML, CSV, DOC/DOCX, XLS/XLSX, PPT/PPTX, ODT, ODS, RTF, etc.)
- โก Multiple converters: TCPDF, mPDF, LibreOffice with intelligent auto-selection
- ๐ก๏ธ Input validation: File size limits, format validation, content verification
- ๐ Comprehensive logging: Detailed operation tracking with PSR-3 compatibility
- ๐ง Flexible configuration: Individual settings for each converter with environment support
- ๐ Converter diagnostics: Built-in tools for checking converter availability and LibreOffice installation
- ๐ฏ Smart error handling: Detailed exception handling with validation feedback
- ๐ Artisan commands: Powerful CLI tools for conversion and diagnostics
- ๐๏ธ Laravel integration: Service provider, facades, and dependency injection ready
- ๐งช Fully tested: Comprehensive test suite with PHPUnit
- ๐ Modern architecture: Interfaces, contracts, and SOLID principles
- ๐จ PHP 8.1+ ready: Modern syntax with match expressions and typed properties
Installation
1. Install the package
2. Publish configuration (optional)
3. Install converters
TCPDF (installed automatically)
mPDF
LibreOffice (for DOC/DOCX/XLS/XLSX)
Advanced Features
Conversion Parameter Configuration
Working with CSV
Checking Converter Availability
Getting Information About All Converters
Checking Specific Converter
Special LibreOffice Check
Usage
Artisan Command for Quick Conversion
The package includes a convenient Artisan command for quick file conversion from the command line:
Available Command Options:
--output- Output PDF file (default: input.pdf)--type- Input data type (auto|text|html|csv|doc|docx|xls|xlsx)--converter- Preferred converter (tcpdf|mpdf|libreoffice)--config- JSON configuration for converter--check- Check converter availability--diagnose- LibreOffice diagnostics--list-formats- Show supported formats--list-converters- Show available converters
Diagnostics and Checking Examples:
Automatic Type Detection:
The command automatically detects input data type:
- By file extension (.txt, .html, .csv, .doc, .docx, .xls, .xlsx)
- By content (HTML tags, CSV delimiters)
- Defaults to text
Configuration Examples:
In Laravel (via Facade)
In Laravel (via Dependency Injection)
Standalone Usage (without Laravel)
๐ Detailed Usage Examples
Basic Conversions
Text to PDF
HTML to PDF with Advanced Styling
CSV to PDF with Custom Options
Office Documents to PDF
Batch Office Document Processing
Advanced Office Document Conversion
Error Handling for Office Documents
Advanced Configuration
Custom Converter Settings
With Custom Logger
Real-World Laravel Examples
E-commerce Invoice Generation
Queue Jobs for Large Documents
Bulk Document Processing
Error Handling
Used Libraries
TCPDF
- Version: ^6.6
- Purpose: PDF generation from text, HTML, CSV
- Features: Lightweight, good Unicode support
- Website: https://tcpdf.org/
mPDF
- Version: ^8.2
- Purpose: Advanced HTML and CSS processing
- Features: Better CSS support, fonts, images
- Website: https://mpdf.github.io/
ncjoes/office-converter
- Version: ^1.0
- Purpose: Office document conversion via LibreOffice
- Requirements: LibreOffice must be installed on server
- GitHub: https://github.com/ncjoes/office-converter
Performance and Recommendations
Converter Selection
- TCPDF: Better for simple documents, faster performance
- mPDF: Better for complex HTML with CSS, images
- LibreOffice: Only option for DOC/DOCX/XLS/XLSX
Optimization
Testing
๐ Requirements
- PHP: 8.1 or higher
- Laravel: 8.0+ (supports Laravel 8, 9, 10, 11, 12)
- TCPDF: Included automatically
- mPDF:
composer require mpdf/mpdf(recommended) - LibreOffice: For office document support (DOC/DOCX/XLS/XLSX/PPT/PPTX/ODT/ODS/ODP)
- Install:
sudo apt-get install libreoffice(Ubuntu/Debian) - Package:
composer require ncjoes/office-converter
- Install:
๐ Supported Formats
| Format | Extension | Converter | Description |
|---|---|---|---|
| Text | .txt |
TCPDF, mPDF | Plain text files |
| HTML | .html, .htm |
mPDF, TCPDF | Web pages and HTML content |
| CSV | .csv |
TCPDF, mPDF, LibreOffice | Comma-separated values |
| Word | .doc, .docx |
LibreOffice | Microsoft Word documents |
| Excel | .xls, .xlsx |
LibreOffice | Microsoft Excel spreadsheets |
| PowerPoint | .ppt, .pptx |
LibreOffice | Microsoft PowerPoint presentations |
| OpenDocument | .odt, .ods, .odp |
LibreOffice | OpenDocument formats |
| Rich Text | .rtf |
LibreOffice | Rich Text Format |
๐งช Testing
๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for your changes
- Ensure tests pass (
composer test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Changelog
Please see CHANGELOG for more information on what has changed recently.
๐ Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
๐ License
The MIT License (MIT). Please see License File for more information.
๐ Support & Troubleshooting
If you encounter issues:
- Check converter availability:
php artisan pdf:convert --check - Diagnose LibreOffice:
php artisan pdf:convert --diagnose - List supported formats:
php artisan pdf:convert --formats - Check logs: Review Laravel logs for detailed error information
- Validate input: Ensure files meet size and format requirements
- Create an issue: GitHub Issues with:
- PHP version
- Laravel version
- Error messages
- Sample code
- Input file details
Common Issues
- LibreOffice not found: Install LibreOffice and ensure it's in PATH
- File too large: Check
validation.max_file_sizesetting - Permission denied: Ensure output directory is writable
- Memory limit: Increase PHP memory limit for large files
License
MIT License. See LICENSE file for details.
Author
- GitHub: madarlan
- Email: [email protected]
Support
If you encounter problems or have questions:
- Check Issues
- Create a new Issue with detailed problem description
- Include PHP, Laravel and library versions
Changelog
v1.0.0
- Initial release
- TCPDF, mPDF, LibreOffice support
- Laravel 8-12 integration
- Text, HTML, CSV, DOC/DOCX, XLS/XLSX to PDF conversion
๐ Credits
- Author: MadArlan
- Contributors: All Contributors
- Powered by : TCPDF, mPDF, LibreOffice
All versions of pdf-bridge-php with dependencies
tecnickcom/tcpdf Version ^6.6
mpdf/mpdf Version ^8.2
ncjoes/office-converter Version ^1.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/config Version ^8.0|^9.0|^10.0|^11.0|^12.0
psr/log Version ^1.0|^2.0|^3.0