Dompdf软件包在laravel中支持其他语言 [英] Dompdf package other languages support in laravel

查看:88
本文介绍了Dompdf软件包在laravel中支持其他语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在laravel项目中使用dompdf软件包创建了我的pdf.但是当我想渲染其他语言(孟加拉)而不是英语

i have created my pdf using dompdf package in laravel project. But when i want to render other language (bangla) instead of english

???????????????????????????? 

显示

.

<body style="font-family: 'AdorshoLipi', Arial, sans-serif !important;">

    <div style="border-style: solid; border-width: 2px; margin: 50px;  padding: 10px;">
        <div align="center">
            <h2>
                 Anti-corruption commission hotline-106
            </h2>
        </div>
        <div>
            <p> Reference No : {{ $complain->call_ref_id }}</p>
            {{-- <br> --}}
            <p> Date : {{ $complain->created_at }}</p>
            <p> Name : {{ $complain->name }}</p>
            <p> Address : {{ $complain->address }}</p>
            <p> Phone Number : {{ $complain->phone_number }}</p>
            <p> Against : {{ $complain->against }}</p>
            <p> Sector : {{ $complain->department }}</p>
            <p style="font-family: 'AdorshoLipi', Arial, sans-serif !important;"> Type : {{ $complain->type }}</p>
            <p> Complain Description : {{ $complain->complain_description }}</p>
            <p> Amount : {{ $complain->amount }}</p>
            <p> Status : {{ $complain->status }}</p>


        </div>

        <div style=" margin-left: 450px; width: 100px; ">
            <hr>
            <label>Signature</label>
        </div>

        <div class="panel-primary">

        </div>

    </div>


</body>

推荐答案

您需要在视图文件的styles标记内添加以下代码

You need to add the following code within the styles tag in the view file

  @font-face {
            font-family: 'iskpota';
            src: url('{{public_path()}}/fonts/your-font.ttf') format('truetype') 
        }
        body{
            font-family: 'your-font', sans-serif; 
        }

然后,您需要将字体文件包含在存储目录中.为此,请在存储文件夹中创建一个名为"fonts"的文件夹,并将"your-font.ttf"文件包含在fonts文件夹中.

Then you need to have the font file included in the storage directory. For that, create a folder named "fonts" right inside the storage folder and include the "your-font.ttf" file within the fonts folder.

PS.您在存储位置添加的这些字体也应该在public/fonts文件夹中可用.

PS. These fonts you add in the storage location should also be available in the public/fonts folder.

这篇关于Dompdf软件包在laravel中支持其他语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆