Japanese letters disappear in PDF

I have managed to include arabic and cjk characters thanks to the answers here. Briefly, to solve the problem:

  • Download the Sun-ExtA and Sun-ExtB fonts from mPDF site and copy them to ‘vendor/mpdf/mpdf/ttfonts/’.

  • Edit the file ‘vendor/mpdf/mpdf/scr/Config/ConfigVariables.php’ and in the “AUTOMATIC FONT SELECTION” section, set to true the variables ‘autoScriptToLang’ and ‘autoLangToFont’ as in,

      // AUTOMATIC FONT SELECTION
      // Based on script and/or language
      // mPDF 6.0 (similar to previously using function SetAutoFont() )
      // 'autoScriptToLang' => false,
      'autoScriptToLang' => true,
      'baseScript' => Ucdn::SCRIPT_LATIN,
      'autoVietnamese' => true,
      'autoArabic' => true,
      // mPDF 6.0 (similar to old useLang)
      // 'autoLangToFont' => false,
      'autoLangToFont' => true,
    

Beware that (as of now) the Sun-Ext fonts are not embedded in the resulting pdf file, and that displaying the japanese characters requires having a proper local font file available to substitute Sun-Ext fonts.