0

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

Pouya
  • 114
  • 1
  • 8
  • 36
  • set proper charset in the html template – OMi Shah Nov 26 '22 at 10:29
  • @OMiShah I used `` but still shows characters like ?????? – Pouya Nov 26 '22 at 10:56
  • try this https://stackoverflow.com/questions/45714545/dompdf-package-other-languages-support-in-laravel, https://stackoverflow.com/questions/46772714/how-to-set-encoding-in-php-fpdi-library and also https://stackoverflow.com/questions/50836255/dompdf-is-showing-utf-8-language-all-words-question-mark – OMi Shah Nov 26 '22 at 10:59

0 Answers0