Laravel Wrapper to Convert PDF to HTML
ibnuhalimm/laravel-pdf-to-html is a Laravel package for laravel wrapper to convert pdf to html.
It currently has 0 GitHub stars and 12.065 downloads on Packagist (latest version v1.2.1).
Install it with composer require ibnuhalimm/laravel-pdf-to-html.
Discover more Laravel packages by ibnuhalimm
or browse all Laravel packages to compare alternatives.
Last updated
Convert PDF to HTML by using pdftohtml on Your Laravel Apps. Special thanks to pdf-to-text (Spatie) package for inspiring this package.
Behind the scene this package leverages pdftohtml. You can verify if the binary installed on your system by executing this command.
which pdftohtml
If it doesn't return the installed path of the binary, you can install the binary using the following command.
apt-get install poppler-utils
yum install poppler-utils
brew install poppler
You can install the package via composer:
composer require ibnuhalimm/laravel-pdf-to-html
Optionally, you can set the config in your .env file:
PDF_TO_HTML_PATH="/usr/bin/pdftohtml"
PDF_TO_HTML_OUTPUT_DIR="/var/www/html/app/public"
PDF_TO_HTML_INLINE_IMAGES=true
Set the file and get result
use Ibnuhalimm\LaravelPdfToHtml\Facades\PdfToHtml;
$sourceFile = '/path/to/your-file.pdf';
PdfToHtml::setFile($sourceFile)->result();
// It will return output file path
// e.g. : /var/www/html/storage/app/pdf-to-html/your-file.html
Save as the result file
use Ibnuhalimm\LaravelPdfToHtml\Facades\PdfToHtml;
$sourceFile = '/path/to/your-file.pdf';
PdfToHtml::setFile($sourceFile)
->saveAs('result-file')
->result();
// It will return output file path as
// e.g. : /var/www/html/storage/app/pdf-to-html/result-file.html
We can set config on-the-fly
use Ibnuhalimm\LaravelPdfToHtml\Facades\PdfToHtml;
$sourceFile = '/path/to/your-file.pdf';
PdfToHtml::setFile($sourceFile)
->setConfig([
'bin_path' => '/usr/local/bin/pdftohtml',
'output_dir' => public_path('/new-location'),
'inline_images' => false
])
->result();
composer test
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.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.