How to fix encoding of generated pdf using Dompdf

216 views Asked by At

I'm using Laravel 9 and Dompdf to generate some pdf files.

And the blade that I'm calling for the pdf files, contains persian/farsi/arabic character languages and therefore the final result will be shown like ????????.

So how can I generate utf-8 fiendly pdf files properly?

public function convertToPdf(Request $request, Order $order)
    {       
        $dompdf = new Dompdf();
        $dompdf->loadHtml(view('admin.shop.orders.order_details_pdf'));
        
        $dompdf->setPaper('A4','landscape');
        
        $dompdf->render();
        
        $dompdf->stream('demo.pdf',['Attachment' => false]);
    }

I would really appreciate any idea or suggestion from you guys...

Thanks

0

There are 0 answers