example28_CJK_using_embedded_fonts.php 7.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. $html = '
  3. <style>
  4. p { text-align: justify; }
  5. td { text-align: justify; }
  6. </style>
  7. <h1>mPDF</h1>
  8. <h2>CJK Languages</h2>
  9. <bookmark content="&#x3042;&#x3081; &#x3064;&#x3061;">
  10. <h4>Japanese (pangrams)</h4>
  11. <h5>Iroha Uta </h5>
  12. <p lang="ja">&#x3044;&#x308d;&#x306f;&#x306b;&#x307b;&#x3078;&#x3068;&#x3000;&#x3061;&#x308a;&#x306c;&#x308b;&#x3092;&#x3000;&#x308f;&#x304b;&#x3088;&#x305f;&#x308c;&#x305d;&#x3000;&#x3064;&#x306d;&#x306a;&#x3089;&#x3080;&#x3000;&#x3046;&#x3090;&#x306e;&#x304a;&#x304f;&#x3084;&#x307e;&#x3000;&#x3051;&#x3075;&#x3053;&#x3048;&#x3066;&#x3000;&#x3042;&#x3055;&#x304d;&#x3086;&#x3081;&#x307f;&#x3057;&#x3000;&#x3091;&#x3072;&#x3082;&#x305b;&#x3059; </p>
  13. <p lang="ja">&#x8272;&#x306f;&#x5302;&#x3078;&#x3069;&#x3000;&#x6563;&#x308a;&#x306c;&#x308b;&#x3092;&#x3000;&#x6211;&#x304c;&#x4e16;&#x8ab0;&#x305e;&#x3000;&#x5e38;&#x306a;&#x3089;&#x3080;&#x3000;&#x6709;&#x70ba;&#x306e;&#x5965;&#x5c71;&#x3000;&#x4eca;&#x65e5;&#x8d8a;&#x3048;&#x3066;&#x3000;&#x6d45;&#x304d;&#x5922;&#x898b;&#x3058;&#x3000;&#x9154;&#x3072;&#x3082;&#x305b;&#x305a;&#xff08;&#x3093;&#xff09; </p>
  14. <h5>Tori Naku Uta </h5>
  15. <p lang="ja">&#x3068;&#x308a;&#x306a;&#x304f;&#x3053;&#x3091;&#x3059;&#x3000;&#x3086;&#x3081;&#x3055;&#x307e;&#x305b;&#x3000;&#x307f;&#x3088;&#x3042;&#x3051;&#x308f;&#x305f;&#x308b;&#x3000;&#x3072;&#x3093;&#x304b;&#x3057;&#x3092;&#x3000;&#x305d;&#x3089;&#x3044;&#x308d;&#x306f;&#x3048;&#x3066;&#x3000;&#x304a;&#x304d;&#x3064;&#x3078;&#x306b;&#x3000;&#x307b;&#x3075;&#x306d;&#x3080;&#x308c;&#x3090;&#x306c;&#x3000;&#x3082;&#x3084;&#x306e;&#x3046;&#x3061; </p>
  16. <p lang="ja">&#x9ce5;&#x557c;&#x304f;&#x58f0;&#x3059;&#x3000;&#x5922;&#x899a;&#x307e;&#x305b;&#x3000;&#x898b;&#x3088;&#x660e;&#x3051;&#x6e21;&#x308b;&#x3000;&#x6771;&#x3092;&#x3000;&#x7a7a;&#x8272;&#x6804;&#x3048;&#x3066;&#x3000;&#x6c96;&#x3064;&#x8fba;&#x306b;&#x3000;&#x5e06;&#x8239;&#x7fa4;&#x308c;&#x3090;&#x306c;&#x3000;&#x9744;&#x306e;&#x4e2d; </p>
  17. <h5>Ametsuchi No Uta </h5>
  18. <p lang="ja">&#x3042;&#x3081; &#x3064;&#x3061; &#x307b;&#x3057; &#x305d;&#x3089; / &#x3084;&#x307e; &#x304b;&#x306f; &#x307f;&#x306d; &#x305f;&#x306b; / &#x304f;&#x3082; &#x304d;&#x308a; &#x3080;&#x308d; &#x3053;&#x3051; / &#x3072;&#x3068; &#x3044;&#x306c; &#x3046;&#x3078; &#x3059;&#x3091; / &#x3086;&#x308f; &#x3055;&#x308b; &#x304a;&#x3075; &#x305b;&#x3088; / &#x3048;&#x306e;&#x3048;*&#x3092; &#x306a;&#x308c; &#x3090;&#x3066; </p>
  19. <p lang="ja">&#x5929; &#x5730; &#x661f; &#x7a7a; / &#x5c71; &#x5ddd; &#x5cf0; &#x8c37; / &#x96f2; &#x9727; &#x5ba4; &#x82d4; / &#x4eba; &#x72ac; &#x4e0a; &#x672b; / &#x786b;&#x9ec4; &#x733f; &#x751f;&#x3075; &#x70ba;&#x3088; / &#x698e;&#x306e; &#x679d;&#x3092; &#x99b4;&#x308c; &#x5c45;&#x3066; </p>
  20. <h5>Taini no Uta </h5>
  21. <p lang="ja">&#x305f;&#x3090;&#x306b;&#x3044;&#x3066;&#x3000;&#x306a;&#x3064;&#x3080;&#x308f;&#x308c;&#x3092;&#x305d;&#x3000;&#x304d;&#x307f;&#x3081;&#x3059;&#x3068;&#x3000;&#x3042;&#x3055;&#x308a;&#x304a;&#x3072;&#x3086;&#x304f;&#x3000;&#x3084;&#x307e;&#x3057;&#x308d;&#x306e;&#x3000;&#x3046;&#x3061;&#x3091;&#x3078;&#x308b;&#x3053;&#x3089;&#x3000;&#x3082;&#x306f;&#x307b;&#x305b;&#x3088;&#x3000;&#x3048;&#x3075;&#x306d;&#x304b;&#x3051;&#x306c; </p>
  22. <p lang="ja">&#x7530;&#x5c45;&#x306b;&#x51fa;&#x3067;&#x3000;&#x83dc;&#x6458;&#x3080;&#x308f;&#x308c;&#x3092;&#x305e;&#x3000;&#x541b;&#x53ec;&#x3059;&#x3068;&#x3000;&#x6c42;&#x98df;&#x308a;&#x8ffd;&#x3072;&#x3086;&#x304f;&#x3000;&#x5c71;&#x57ce;&#x306e;&#x3000;&#x6253;&#x9154;&#x3078;&#x308b;&#x5b50;&#x3089;&#x3000;&#x85fb;&#x8449;&#x5e72;&#x305b;&#x3088;&#x3000;&#x3048;&#x821f;&#x7e4b;&#x3051;&#x306c; </p>
  23. <bookmark content="&#x7f8e;&#x56fd;&#x822a;&#x7a7a;&#x4e1a;&#x5de8;">
  24. <h4>Chinese (simplified) GB2312</h4>
  25. <p lang="zh-CN">&#x6765;&#x81ea;&#x5546;&#x52a1;&#x90e8;&#x65b0;&#x95fb;&#x529e;&#x516c;&#x5ba4;&#x7684;&#x6d88;&#x606f;&#x79f0;&#xff0c;&#x4e2d;&#x65b9;&#x514d;&#x9664;&#x4e0e;&#x4e2d;&#x56fd;&#x6709;&#x5916;&#x4ea4;&#x5173;&#x7cfb;&#x7684;&#x6240;&#x6709;&#x975e;&#x6d32;&#x91cd;&#x503a;&#x7a77;&#x56fd;&#x53ca;&#x6700;&#x4e0d;&#x53d1;&#x8fbe;&#x56fd;&#x5bb6;&#x622a;&#x81f3;2005&#x5e74;&#x5e95;&#x5bf9;&#x534e;&#x5230;&#x671f;&#x653f;&#x5e9c;&#x65e0;&#x606f;&#x8d37;&#x6b3e;&#x503a;&#x52a1;&#x3002;&#x6709;&#x5173;&#x90e8;&#x95e8;&#x5df2;&#x5bf9;&#x76f8;&#x5173;&#x503a;&#x52a1;&#x8fdb;&#x884c;&#x5168;&#x9762;&#x6e05;&#x7406;&#x6838;&#x5bf9;&#xff0c;&#x5bf9;&#x4e0e;&#x4e2d;&#x56fd;&#x6709;&#x5916;&#x4ea4;&#x5173;&#x7cfb;&#x7684;33&#x4e2a;&#x975e;&#x6d32;&#x91cd;&#x503a;&#x7a77;&#x56fd;&#x548c;&#x6700;&#x4e0d;&#x53d1;&#x8fbe;&#x56fd;&#x5bb6;&#xff0c;&#x514d;&#x9664;&#x5176;&#x622a;&#x81f3;2005&#x5e74;&#x5e95;168&#x7b14;&#x5bf9;&#x534e;&#x5230;&#x671f;&#x65e0;&#x606f;&#x8d37;&#x6b3e;&#x503a;&#x52a1;&#x3002;&#x62df;&#x4e8e;2007&#x5e74;&#x5e95;&#x524d;&#x4e0e;&#x53d7;&#x63f4;&#x56fd;&#x529e;&#x7406;&#x5b8c;&#x514d;&#x503a;&#x534f;&#x8bae;&#x3002;</p>
  26. <bookmark content="&#x300c;&#x6182;&#x9b31;&#x5c0f;&#x738b;&#x5b50;&#x300d;">
  27. <h4>Chinese (Traditional - Hong Kong)</h4>
  28. <p lang="zh-HK">&#x300c;&#x6182;&#x9b31;&#x5c0f;&#x738b;&#x5b50;&#x300d;&#x662f;&#x4e00;&#x500b;&#x6559;&#x80b2;&#x7db2;&#x7ad9;&#xff0c;&#x5b83;&#x6210;&#x529f;&#x7d50;&#x5408;&#x4e86;&#x9999;&#x6e2f;&#x8cfd;&#x99ac;&#x6703;&#x9632;&#x6b62;&#x81ea;&#x6bba;&#x7814;&#x7a76;&#x4e2d;&#x5fc3;&#x5404;&#x65b9;&#x9762;&#x7684;&#x5c08;&#x624d;&#xff0c;&#x70ba;&#x9752;&#x5c11;&#x5e74;&#x4eba;&#x63d0;&#x4f9b;&#x7cbe;&#x795e;&#x5065;&#x5eb7;&#x7684;&#x8a0a;&#x606f;&#xff0c;&#x5c0d;&#x666e;&#x53ca;&#x6291;&#x9b31;&#x75c7;&#x77e5;&#x8b58;&#x7684;&#x8ca2;&#x737b;&#x826f;&#x591a;&#x3002;&#x5728;&#x9999;&#x6e2f;&#xff0c;&#x5b83;&#x66fe;&#x7372;&#x9078;&#x70ba;&#x300c;2004&#x5e74;&#x5341;&#x5927;&#x5065;&#x5eb7;&#x7db2;&#x7ad9;&#x300d;&#x4e4b;&#x4e00;&#xff0c;&#x8a72;&#x9805;&#x9078;&#x8209;&#x81ea;2005&#x5e74;&#x8d77;&#x6539;&#x540d;&#x73fe;&#x6642;&#x7684;&#x300c;&#x512a;&#x79c0;&#x7db2;&#x7ad9;&#x9078;&#x8209;&#x300d;&#x3002;&#x5176;&#x8ca2;&#x737b;&#x5728;&#x570b;&#x969b;&#x9593;&#x4ea6;&#x5099;&#x53d7;&#x80af;&#x5b9a;&#xff0c;2005&#x5e74;&#xff0c;&#x8a72;&#x7db2;&#x7ad9;&#x69ae;&#x7372;&#x7b2c;&#x516b;&#x5c46;&#x300c;&#x4e9e;&#x6d32;&#x5275;&#x65b0;&#x5927;&#x734e;&#x300d;&#x9280;&#x734e;&#x3002;</p>
  29. <bookmark content="&#xd0a4;&#xc2a4;&#xc758;">
  30. <h4>Korean</h4>
  31. <p lang="ko">&#xd0a4;&#xc2a4;&#xc758; &#xace0;&#xc720;&#xc870;&#xac74;&#xc740; &#xc785;&#xc220;&#xb07c;&#xb9ac; &#xb9cc;&#xb098;&#xc57c; &#xd558;&#xace0; &#xd2b9;&#xbcc4;&#xd55c; &#xae30;&#xc220;&#xc740; &#xd544;&#xc694;&#xce58; &#xc54a;&#xb2e4;. </p>
  32. </div>';
  33. //==============================================================
  34. //==============================================================
  35. //==============================================================
  36. require_once __DIR__ . '/../vendor/autoload.php';
  37. $mpdf = new mPDF('-aCJK','A4','','',32,25,27,25,16,13);
  38. $mpdf->SetDisplayMode('fullpage');
  39. // LOAD a stylesheet
  40. $stylesheet = file_get_contents('mpdfstyleA4.css');
  41. $mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
  42. $mpdf->autoLangToFont = true;
  43. $mpdf->WriteHTML($html);
  44. $mpdf->Output();
  45. exit;
  46. //==============================================================
  47. //==============================================================
  48. //==============================================================