1

i wanted to show the font awesome icons in pdf view. I tried something like this.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

<table class="table table-hover table-bordered">
            <thead>
              <tr>
                <th>#</th>  
                <th>Account</th>
                <th>Debit</th>
                <th>Credit</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1</td>
                <td><?php echo $model->account; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->debit; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
              </tr>
              <tr>
                <td>2</td>
                <td><?php echo $model->against; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->debit; ?></td>
              </tr>
              <tr>
                <td colspan="2"></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
              </tr>
            </tbody>
        </table>

it didn't work. So i googled and i found another question

i tried this link here

based on that i changed my code like this

<table class="table table-hover table-bordered">
            <thead>
              <tr>
                <th>#</th>  
                <th>Account</th>
                <th>Debit</th>
                <th>Credit</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1</td>
                <td><?php echo $model->account; ?></td>
                <td><i class="fa"> &#xf156;</i> <?php echo $model->debit; ?></td>
                <td><i class="fa"> &#xf156;</i> <?php echo $model->credit; ?></td>
              </tr>
              <tr>
                <td>2</td>
                <td><?php echo $model->against; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->debit; ?></td>
              </tr>
              <tr>
                <td colspan="2"></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
                <td><i class="fa fa-inr"></i> <?php echo $model->credit; ?></td>
              </tr>
            </tbody>
        </table>

(i changed only two fields ok). Also downloaded fontawesome file from github and copy fonts/fontawesome-webfont.ttf into your MPDF ttfonts/ directory. And In my MDPF config_fonts.php file, i added the lines mentioned in the link but it didn't work too.

Community
  • 1
  • 1
Bloodhound
  • 2,906
  • 11
  • 37
  • 71
  • Possible duplicate of [How to use Font Awesome with MPDF?](https://stackoverflow.com/questions/31432228/how-to-use-font-awesome-with-mpdf) – Finwe Jun 26 '18 at 06:20

1 Answers1

5

I had the same problem, follow all of the steps in the answer here How to use Font Awesome with MPDF? , the key thing for me was to add font-family:fontawesome; e.g.

<i style="font-family:fontawesome;" class="fa">&#xf118;</i>
Community
  • 1
  • 1
SamMaj
  • 358
  • 1
  • 5
  • 14