Download the PHP package break-down/pdf-to-image without Composer
On this page you can find all versions of the php package break-down/pdf-to-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download break-down/pdf-to-image
More information about break-down/pdf-to-image
Files in break-down/pdf-to-image
Package pdf-to-image
Short Description Convert a pdf to an image
License MIT
Homepage https://github.com/break-down/pdf-to-image
Informations about the package pdf-to-image
Convert a PDF to an Image
A wrapper around Imagick to ease out conversion of PDF file to a JPEG/JPG image.
Requirements
You should have Imagick and Ghostscript installed. See issues regarding Ghostscript.
Installation
The package can be installed via composer:
Usage
Converting a pdf to an image is easy.
If the path you pass to saveImage
has the extensions jpg
, jpeg
, or png
the image will be saved in that format.
Otherwise the output will be a jpg.
Other methods
You can get the total number of pages in the pdf:
You can override the output format:
You can set the quality of compression from 0 to 100:
Issues regarding Ghostscript
This package uses Ghostscript through Imagick. For this to work Ghostscripts gs
command should be accessible from the PHP process. For the PHP CLI process (e.g. Laravel's asynchronous jobs, commands, etc...) this is usually already the case.
However for PHP on FPM (e.g. when running this package "in the browser") you might run into the following problem:
This can be fixed by adding the following line at the end of your php-fpm.conf
file and restarting PHP FPM. If you're unsure where the php-fpm.conf
file is located you can check phpinfo()
.
This will instruct PHP FPM to look for the gs
binary in the right places.
Credits
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of pdf-to-image with dependencies
ext-imagick Version *