Chinese and japanese characters available ininvoices pdf
This commit is contained in:
parent
e72561278b
commit
c36c9c63e6
@ -14,8 +14,6 @@ use App\Jobs\Document\UpdateDocument;
|
||||
use App\Models\Document\Document;
|
||||
use App\Notifications\Sale\Invoice as Notification;
|
||||
use App\Traits\Documents;
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
|
||||
class Invoices extends Controller
|
||||
{
|
||||
@ -291,20 +289,6 @@ class Invoices extends Controller
|
||||
*/
|
||||
public function pdfInvoice(Document $invoice)
|
||||
{
|
||||
define("DOMPDF_UNICODE_ENABLED", true);
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
$options = new Options();
|
||||
$options->set('defaultFont', 'Noto Sans');
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
$dompdf->set_option('defaultMediaType', 'all');
|
||||
$dompdf->set_option('isFontSubsettingEnabled', true);
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
|
||||
|
||||
$file_name = $this->getDocumentFileName($invoice);
|
||||
|
||||
event(new \App\Events\Document\DocumentPrinting($invoice));
|
||||
|
||||
$currency_style = true;
|
||||
@ -313,13 +297,12 @@ class Invoices extends Controller
|
||||
|
||||
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
$dompdf = app('dompdf.wrapper');
|
||||
$file_name = $this->getDocumentFileName($invoice);
|
||||
|
||||
$dompdf->loadHTML($html, 'UTF-8');
|
||||
$pdf = app('dompdf.wrapper');
|
||||
$pdf->loadHTML($html);
|
||||
|
||||
// return $pdf->download($file_name);
|
||||
|
||||
return $dompdf->stream();
|
||||
return $pdf->download($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +151,7 @@ return [
|
||||
* Used if no suitable fonts can be found. This must exist in the font folder.
|
||||
* @var string
|
||||
*/
|
||||
"default_font" => "",
|
||||
"default_font" => "DejaVu Sans, sans-serif",
|
||||
|
||||
/**
|
||||
* Image DPI setting
|
||||
|
Binary file not shown.
BIN
public/css/fonts/NotoSansCJK-Regular.ttc
Normal file
BIN
public/css/fonts/NotoSansCJK-Regular.ttc
Normal file
Binary file not shown.
BIN
public/css/fonts/firefly_sung_normal.ttf
Normal file
BIN
public/css/fonts/firefly_sung_normal.ttf
Normal file
Binary file not shown.
13
public/css/print.css
vendored
13
public/css/print.css
vendored
@ -1,22 +1,11 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
/*--General Start--*/
|
||||
|
||||
@font-face {
|
||||
font-family: 'Noto Sans';
|
||||
src: url("public/fonts/NotoSans-Regular.ttf") format("truetype");
|
||||
}
|
||||
|
||||
|
||||
* {
|
||||
font-family: 'Noto Sans', sans-serif !important;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Noto Sans';
|
||||
font-family: Arial, sans-serif;
|
||||
color: #3c3f72;
|
||||
}
|
||||
|
||||
|
@ -310,3 +310,47 @@
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
||||
<?php $currency_style = false; ?>
|
||||
|
||||
@if (app()->getLocale() == "zh-CN" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "ja-JP" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "zh-TW" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($currency_style)
|
||||
@push('stylesheet')
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'normal';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'bold';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'italic';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Firefly Sung', sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@endif
|
||||
|
@ -293,3 +293,48 @@
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
||||
<?php $currency_style = false; ?>
|
||||
|
||||
@if (app()->getLocale() == "zh-CN" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "ja-JP" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "zh-TW" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($currency_style)
|
||||
@push('stylesheet')
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'normal';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'bold';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'italic';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Firefly Sung', sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@endif
|
||||
|
||||
|
@ -48,3 +48,47 @@
|
||||
@endif
|
||||
@stack('total_td_end')
|
||||
</tr>
|
||||
|
||||
|
||||
<?php $currency_style = false; ?>
|
||||
|
||||
@if (app()->getLocale() == "zh-CN" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "ja-JP" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "zh-TW" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($currency_style)
|
||||
@push('stylesheet')
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'normal';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'bold';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'italic';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Firefly Sung', sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@endif
|
||||
|
@ -276,3 +276,46 @@
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<?php $currency_style = false; ?>
|
||||
|
||||
@if (app()->getLocale() == "zh-CN" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "ja-JP" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
@if (app()->getLocale() == "zh-TW" )
|
||||
<?php $currency_style = true; ?>
|
||||
@endif
|
||||
|
||||
|
||||
@if ($currency_style)
|
||||
@push('stylesheet')
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'normal';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'bold';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Firefly Sung';
|
||||
font-weight: 'italic';
|
||||
src: url("/public/css/fonts/firefly_sung_normal.ttf") format("truetype");
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Firefly Sung', sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@endif
|
||||
|
@ -4,30 +4,24 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8;"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8; charset=ISO-8859-1"/>
|
||||
|
||||
<title>@yield('title') - @setting('company.name')</title>
|
||||
|
||||
<base href="{{ config('app.url') . '/' }}">
|
||||
<base href="{{ config("app.url") . '/' }}">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" href="{{ asset('public/img/favicon.ico') }}" type="image/png">
|
||||
|
||||
<!-- Css -->
|
||||
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
|
||||
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: "Noto Sans",
|
||||
src: url("{{ asset('public/fonts/NotoSans-Regular.ttf') }}") format("truetype");
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: 'Noto Sans', sans-serif !important;
|
||||
font-family: DejaVu Sans, sans-serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
|
||||
|
||||
@stack('css')
|
||||
|
||||
@stack('stylesheet')
|
||||
|
Loading…
x
Reference in New Issue
Block a user