karkowg / php-mupdf
Minimal PDF to image converter using MuPDF
Fund package maintenance!
karkowg
Installs: 1 308
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 1
Forks: 3
Open Issues: 1
Requires
- php: ^8.0
- symfony/process: ^6.0|^7.0
Requires (Dev)
- pestphp/pest: ^1.21
- squizlabs/php_codesniffer: ^3.0
- dev-main
- 3.x-dev
- v3.0.0-rc23
- v3.0.0-rc22
- v3.0.0-rc21
- v3.0.0-rc20
- v3.0.0-rc19
- v3.0.0-rc18
- v3.0.0-rc17
- v3.0.0-rc16
- v3.0.0-rc15
- v3.0.0-rc14
- v3.0.0-rc13
- v3.0.0-rc12
- v3.0.0-rc11
- v3.0.0-rc10
- v3.0.0-rc9
- v3.0.0-rc8
- v3.0.0-rc7
- v3.0.0-rc6
- v3.0.0-rc5
- v3.0.0-rc4
- v3.0.0-rc3
- v3.0.0-rc2
- v3.0.0-rc1
- v2.0.1
- v2.0.0
- v1.1.0
- v1.0.0
This package is auto-updated.
Last update: 2024-12-14 16:20:38 UTC
README
php-mupdf
Minimal PDF to image converter using MuPDF. Heavily inspired by spatie/image-to-pdf.
Install
Via Composer
$ composer require karkowg/php-mupdf
Usage
Convert all the pages to jpg
$pdf = new Karkow\MuPdf\Pdf('path/to/pdf/file'); $pdf->saveAllPagesAsImages('./images/', 'page-');
Convert a single page to png
$pdf = new Karkow\MuPdf\Pdf('path/to/pdf/file'); $pdf ->setPage(2) ->setOutputFormat('png') ->saveImage('./images/page-2.png');
Please refer to tests/PdfTest.php
for other use cases.
mutool
A compiled binary (v1.20.0) is available at bin/mutool
. If for any reason you want/need to use your own installation, you can do so by passing its path as a 2nd argument to the constructor.
$pdf = new Karkow\MuPdf\Pdf('path/to/pdf/file', 'path/to/mutool');
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email karkowg@gmail.com instead of using the issue tracker.
Credits
- Gustavo Karkow
- [All Contributors][link-contributors]
License
The MIT License (MIT). Please see License File for more information.