diff --git a/app/Http/Controllers/Sales/Invoices.php b/app/Http/Controllers/Sales/Invoices.php index 31b2055d7..fdeab8d09 100644 --- a/app/Http/Controllers/Sales/Invoices.php +++ b/app/Http/Controllers/Sales/Invoices.php @@ -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 { @@ -290,36 +288,21 @@ class Invoices extends Controller * @return Response */ 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; $view = view($invoice->template_path, compact('invoice', 'currency_style'))->render(); - + $html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8'); - $dompdf = app('dompdf.wrapper'); - - $dompdf->loadHTML($html, 'UTF-8'); + $file_name = $this->getDocumentFileName($invoice); - // return $pdf->download($file_name); + $pdf = app('dompdf.wrapper'); + $pdf->loadHTML($html); - return $dompdf->stream(); + return $pdf->download($file_name); } /** diff --git a/config/dompdf.php b/config/dompdf.php index 1570ee891..5d6e55c1c 100644 --- a/config/dompdf.php +++ b/config/dompdf.php @@ -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 diff --git a/public/css/fonts/NotoSans-Regular.ttf b/public/css/fonts/NotoSans-Regular.ttf deleted file mode 100644 index 10589e277..000000000 Binary files a/public/css/fonts/NotoSans-Regular.ttf and /dev/null differ diff --git a/public/css/fonts/NotoSansCJK-Regular.ttc b/public/css/fonts/NotoSansCJK-Regular.ttc new file mode 100644 index 000000000..52cb36121 Binary files /dev/null and b/public/css/fonts/NotoSansCJK-Regular.ttc differ diff --git a/public/css/fonts/firefly_sung_normal.ttf b/public/css/fonts/firefly_sung_normal.ttf new file mode 100644 index 000000000..1484f5aee Binary files /dev/null and b/public/css/fonts/firefly_sung_normal.ttf differ diff --git a/public/css/print.css b/public/css/print.css index aa93b4817..6a610af91 100644 --- a/public/css/print.css +++ b/public/css/print.css @@ -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; } diff --git a/resources/views/components/documents/template/classic.blade.php b/resources/views/components/documents/template/classic.blade.php index 5222f162c..2de33f7cb 100644 --- a/resources/views/components/documents/template/classic.blade.php +++ b/resources/views/components/documents/template/classic.blade.php @@ -310,3 +310,47 @@ @endif @endif + + + + +@if (app()->getLocale() == "zh-CN" ) + +@endif + +@if (app()->getLocale() == "ja-JP" ) + +@endif + +@if (app()->getLocale() == "zh-TW" ) + +@endif + + +@if ($currency_style) + @push('stylesheet') + + @endpush +@endif diff --git a/resources/views/components/documents/template/default.blade.php b/resources/views/components/documents/template/default.blade.php index 198e122a0..a7b1626f4 100644 --- a/resources/views/components/documents/template/default.blade.php +++ b/resources/views/components/documents/template/default.blade.php @@ -293,3 +293,48 @@ @endif @endif + + + + +@if (app()->getLocale() == "zh-CN" ) + +@endif + +@if (app()->getLocale() == "ja-JP" ) + +@endif + +@if (app()->getLocale() == "zh-TW" ) + +@endif + + +@if ($currency_style) + @push('stylesheet') + + @endpush +@endif + diff --git a/resources/views/components/documents/template/line-item.blade.php b/resources/views/components/documents/template/line-item.blade.php index 8f401b63a..6e5d3a267 100644 --- a/resources/views/components/documents/template/line-item.blade.php +++ b/resources/views/components/documents/template/line-item.blade.php @@ -48,3 +48,47 @@ @endif @stack('total_td_end') + + + + +@if (app()->getLocale() == "zh-CN" ) + +@endif + +@if (app()->getLocale() == "ja-JP" ) + +@endif + +@if (app()->getLocale() == "zh-TW" ) + +@endif + + +@if ($currency_style) + @push('stylesheet') + + @endpush +@endif diff --git a/resources/views/components/documents/template/modern.blade.php b/resources/views/components/documents/template/modern.blade.php index ae7be9ce2..93af047ed 100644 --- a/resources/views/components/documents/template/modern.blade.php +++ b/resources/views/components/documents/template/modern.blade.php @@ -276,3 +276,46 @@ @endif @endif + + + +@if (app()->getLocale() == "zh-CN" ) + +@endif + +@if (app()->getLocale() == "ja-JP" ) + +@endif + +@if (app()->getLocale() == "zh-TW" ) + +@endif + + +@if ($currency_style) + @push('stylesheet') + + @endpush +@endif diff --git a/resources/views/partials/print/head.blade.php b/resources/views/partials/print/head.blade.php index f5bdc703b..71bc71c2b 100644 --- a/resources/views/partials/print/head.blade.php +++ b/resources/views/partials/print/head.blade.php @@ -4,30 +4,24 @@ - + @yield('title') - @setting('company.name') - + + - - @stack('css') @stack('stylesheet')