%PDF- %PDF-
Direktori : /var/www/html/hrsys/api/vendor/spatie/pdf-to-image/ |
Current File : /var/www/html/hrsys/api/vendor/spatie/pdf-to-image/README.md |
# Convert a pdf to an image [](https://packagist.org/packages/spatie/pdf-to-image) [](LICENSE.md) [](https://travis-ci.org/spatie/pdf-to-image) [](https://insight.sensiolabs.com/projects/e99ed9fd-89c4-4963-a0cf-02fe46714def) [](https://scrutinizer-ci.com/g/spatie/pdf-to-image) [](https://styleci.io/repos/38419604) [](https://packagist.org/packages/spatie/pdf-to-image) This package provides an easy to work with class to convert pdf's to images. Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource). ## Postcardware You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium. All postcards are published [on our website](https://spatie.be/en/opensource/postcards). ## Requirements You should have [Ghostscript](http://www.ghostscript.com/) installed. ## Install The package can be installed via composer: ``` bash $ composer require spatie/pdf-to-image ``` ## Usage Converting a pdf to an image is easy. ```php $pdf = new Spatie\PdfToImage\Pdf($pathToPdf); $pdf->saveImage($pathToWhereImageShouldBeStored); ``` 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: ```php $pdf->getNumberOfPages(); //returns an int ``` By default the first page of the pdf will be rendered. If you want to render another page you can do so: ```php $pdf->setPage(2) ->saveImage($pathToWhereImageShouldBeStored); //saves the second page ``` You can override the output format: ```php $pdf->setOutputFormat('png') ->saveImage($pathToWhereImageShouldBeStored); //the output wil be a png, no matter what ``` ## Change log Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Testing ``` bash $ composer test ``` ## Contributing Please see [CONTRIBUTING](CONTRIBUTING.md) for details. ## Security If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker. ## Credits - [Freek Van der Herten](https://github.com/spatie) - [All Contributors](../../contributors) ## About Spatie Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource). ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information.