| Install | |
|---|---|
composer require clippings/phantom-pdf |
Install via composer
$ composer global require clippings/phantom-pdf
$pdf = new PdfGenerator();
// Set a writable path for temporary files
$pdf->setStoragePath('storage/path');
// Saves the PDF as a file
$pdf->saveFromView($html, 'filename.pdf');
Use setBinaryPath('path') to use another version of PhantomJS.
If you want to use another script to execute with PhantomJS, this it how you do it.
$pdf->useScript('path/to/script');
return $pdf->saveFromView('view');
Forked from the great https://github.com/danielboendergaard/phantom-pdf package
Copyright (c) 2015, Clippings Ltd. Refactored by Ivan Kerin as part of clippings.com