beyondplus/laravel-tcpdf
TCPDF Custom Font for Myanmar
157
1
| Install | |
|---|---|
composer require beyondplus/laravel-tcpdf |
|
| Latest Version: | 5.4.6 |
| License: | MIT |
| Last Updated: | May 10, 2017 |
| Links: | GitHub · Packagist |
Maintainer: beyondplus
laravel-tcpdf
Custom Myanmar Font View PDF Generator
Requirement
laravel 5.4
Configure
Find config/app.php in Project Folder
'providers' => [
//...
Elibyy\TCPDF\ServiceProvider::class,
BeyondPlus\TCPDF\TcpdfServiceProvider::class,
]
//...
'aliases' => [
//...
'MMTCPDF' => BeyondPlus\TCPDF\Facades\MMTCPDF::class,
]
Usage
use MMTCPDF;
At function
$fontname = MMTCPDF::font('Zawgyi-One');
//$fontname = MMTCPDF::font('Myanmar3');
MMTCPDF::SetFont($fontname , 11);
MMTCPDF::SetTitle('Record Report');
MMTCPDF::AddPage('P','A4');
MMTCPDF::writeHtml("Myanmar Words");
MMTCPDF::Output('report.pdf', 'I');
Example
$query = Database::get();
$fontname = MMTCPDF::font('Zawgyi-One');
MMTCPDF::SetFont($fontname , 11);
MMTCPDF::SetTitle('Record Report');
MMTCPDF::AddPage('P','A4');
MMTCPDF::writeHtml(view('pdf', array('records'=> $query)));
MMTCPDF::Output('report.pdf', 'I');
Margin
MMTCPDF::SetMargins(1, 1, 1);
Paper Size
MMTCPDF::AddPage ->
P = Portrait
L = Landscape
MMTCPDF::Output ->
F = localserver download
D = download
I = inline
$pagelayout = array('80', '210');
MMTCPDF::AddPage('P',$pagelayout);
// Background Image (width x height unit mm)
$img_file = public_path('upload/').'images.jpg';
MMTCPDF::setBgImage($img_file, 210, 148);
At the Blade Template
<span style="font-family:Zawgyi-One">ျမန္မာစာ</span>
Font Converter For Myanmar 3
php artisan vendor:publish
- see the App/Http/helper.php function
- integrate it at laravel autoload and use it
Refrence
License
The Beyond Plus Laravel TCPDF is open-sourced software licensed under the MIT license.