This package is a wrapper for engines to make easier generate PDF files from PHP. PDFLatex is the default engine. Excelent pandoc engine will be also provided, so more output formats can be achiueved.
Software for the engine should be installed first. Default is pdflatex:
Faster but bigger:
sudo apt-get update
sudo apt-get install texlive-full poppler-utils
Slower but smaller (manually selecting packages, for example):
sudo apt-get update
sudo apt-get install texlive-base texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-science texlive-fonts-recommended texlive-fonts-extra texlive-lang-english texlive-lang-spanish poppler-utils
You can install the package via composer:
composer require davidjr82/php-pdf-generator
return (new PDFGenerator())->setTestRenderedSource()->showInBrowser('filename.pdf');
return (new PDFGenerator())->setTestRenderedSource()->download('filename.pdf');
return (new PDFGenerator())->setTestRenderedSource()->saveFile('filename.pdf');
$tex = file_get_contents('path/to/file.tex');
return (new PDFGenerator())->setRenderedSource($tex)->showInBrowser('filename.pdf');
return (new PDFGenerator())->setRenderedSource($tex)->download('filename.pdf');
return (new PDFGenerator())->setRenderedSource($tex)->saveFile('filename.pdf');
$view = view('path.to.blade', $data)->render();
return (new PDFGenerator())->setRenderedSource($view)->showInBrowser('filename.pdf');
return (new PDFGenerator())->setRenderedSource($view)->download('filename.pdf');
return (new PDFGenerator())->setRenderedSource($view)->saveFile('filename.pdf');
I know, I know... in the todo list.
composer test
- Tests
- Add pandoc library to generate PDF
- Allow more input and output formats with pandoc
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
- (BSD license) https://www.php.net
- (MIT license) https://github.com/symfony/process
- (MIT license) https://github.com/techsemicolon/laravel-php-latex
The MIT License (MIT). Please see License File for more information.