Chinese and japanese characters available ininvoices pdf

This commit is contained in:
benguozakinci@gmail.com
2021-09-07 12:17:01 +03:00
parent e72561278b
commit c36c9c63e6
11 changed files with 188 additions and 46 deletions

View File

@ -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);
}
/**