clippings/phantom-pdf

A Package for generating PDF files using PhantomJS

0.12.0 2020-02-11 12:58 UTC

README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version

Installation

Install via composer

$ composer global require clippings/phantom-pdf

Usage

$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.

Customizing the conversion script

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');

Credits

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