1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel PDF日本語化で一部文字化けが起きる時の対処

Posted at

環境

  • PHP 7.2
  • Laravel 6.x
  • Composer library
    • barryvdh/laravel-dompdf

事象

前提の日本語対応済み。
請求書のPDFでご請求金額と表示されるはずが、ご☒☒☒☒といった感じで一部の日本語が文字化けを起こす。

前提

日本語対応

  1. barryvdh/laravel-dompdfライブラリをインストール
  2. IPAからフォントダウンロード
  3. storage/fonts/配下に配置
  4. inline cssで@font-face font-family定義

対処

  1. storage/fonts配下に自動生成されるファイル削除。
    • dompdf_font_family_cache.php
    • ipag-bold_*.ttf
    • ipag-bold_*.ufm
    • ipag-bold_*.ufm.php
    • ipag-normal_*.ttf
    • ipag-normal_*.ufm
    • ipag-normal_*.ufm.php
    • Times-Bold.afm.php
    • Times-Roman.afm.php
  2. 念の為、キャッシュ一式クリアする
    • php artisan optimize:clear
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?