1. Go to this page and download the library: Download khmer-pdf/laravel-kh-pdf 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/ */
khmer-pdf / laravel-kh-pdf example snippets
use Illuminate\Support\Facades\Route;
use KhmerPdf\LaravelKhPdf\Facades\PdfKh;
Route::get('/', function () {
$view = view('test-font')->render();
$pdf = PdfKh::loadHtml($view)->stream('test.pdf');
return $pdf;
});
use Illuminate\Support\Facades\Route;
use KhmerPdf\LaravelKhPdf\Facades\PdfKh;
Route::get('/', function () {
$view = view('test-font')->render();
$pdf = PdfKh::loadHtml($view)->addMPdfConfig(['format' => 'A5',])->stream('test.pdf');
return $pdf;
});
addMPdfConfig(['format' => 'A5-L',]);
'pdf' => [
'default_font' => 'battambang', // Set your default font here
// Path to the font files in your public directory
'font_path' => public_path('fonts/'),
'font_data' => [
'battambang' => [ // lowercase letters only in font key
'R' => 'KhmerOSbattambang.ttf',
'B' => 'KhmerOSBattambang-Bold.ttf',
'useOTL' => 0xFF,
],
'khmermuol' => [ // lowercase letters only in font key
'R' => 'KhmerOSmuol.ttf',
'useOTL' => 0xFF,
],
],
],
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.