1. Go to this page and download the library: Download unknow-sk/laravel-pdf-to library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
unknow-sk / laravel-pdf-to example snippets
return [
/**
* Set the pdftotext binary path manually
*/
'pdftotext_bin' => env('PDF_TO_TEXT_PATH'),
/**
* Set the pdftohtml binary path manually
*/
'pdftohtml_bin' => env('PDF_TO_HTML_PATH'),
/**
* Set the pdftoppm binary path manually
*/
'pdftoppm_bin' => env('PDF_TO_PPM_PATH'),
/**
* Set the pdftocairo binary path manually
*/
'pdftocairo_bin' => env('PDF_TO_CAIRO_PATH'),
/**
* Set the default output directory
*/
'output_dir' => env('PDF_TO_OUTPUT_DIR', storage_path('app/pdf-to')),
];
use UnknowSk\LaravelPdfTo\Facades\LaravelPdfTo;
$html = LaravelPdfTo::setFile('path/to/your/file.pdf')
->setConfig(['options' => [...]]) // optionally
->saveAs('output-file') // optionally, if you wan to store as file, then result returns path
->result('html');
echo $html;
use UnknowSk\LaravelPdfTo\Facades\LaravelPdfTo;
$image = LaravelPdfTo::setFile('path/to/your/file.pdf')
->setTimeout(180) // optionally
->result('png');
echo $image; // Path to the generated image
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.