前提・実現したいこと
PHPでTFPDFを用いて、PDFを日本語で出力するシステムを作っています。
日本語フォントをダウンロードして配置、使っています。
発生している問題・エラーメッセージ
ローカルサーバーで動かしたところうまく行ったのですが、レンタルサーバーにアップしたところ以下のエラーメッセージが発生しました。
Font (http://girly.lolitapunk.jp/pdfcreater/tfpdf/font/unifont/ShipporiMincho-TTF-Regular.ttf) does not have cmap for Unicode (platform 3, encoding 1, format 4, or platform 0, any encoding, format 4)
該当のソースコード
pdfcreater └── makepdf.php └── tfpdf └── tfpdf.php └── unifont └── shipporimincho-ttf-regular.cw.dat shipporimincho-ttf-regular.cw127.php shipporimincho-ttf-regular.mtx.php ShipporiMincho-TTF-Regular.ttf
php
1//makepdf.php 2<?php 3require('tfpdf/tfpdf.php'); 4 5$pdf = new tFPDF; 6$pdf->AddFont('ShipporiMincho','','ShipporiMincho-TTF-Regular.ttf',true); 7 8$pdf->Output();
フォントのパスはサーバー上のものに変更してあります。
PHP
1//shipporimincho-ttf-regular.mtx.php 2<?php 3$name='ShipporiMincho-TTF-Regular'; 4$type='TTF'; 5$desc=array ( 6 'Ascent' => 880.0, 7 'Descent' => -120.0, 8 'CapHeight' => 729.0, 9 'Flags' => 4, 10 'FontBBox' => '[-997 -549 2426 1329]', 11 'ItalicAngle' => 0.0, 12 'StemV' => 87.0, 13 'MissingWidth' => 1000.0, 14); 15$up=-475; 16$ut=50; 17$ttffile='http://girly.lolitapunk.jp/pdfcreater/tfpdf/font/unifont/ShipporiMincho-TTF-Regular.ttf'; 18// $ttffile='/Applications/MAMP/htdocs/PHPadvanced/tfpdf/font/unifont/ShipporiMincho-TTF-Regular.ttf'; 19$originalsize=10055488; 20$fontkey='shipporimincho'; 21?>
試したこと
cmapが必要とのことなので、下記からダウンロードし、cmap-resourcesとしてunifont配下に設置しました。
https://github.com/adobe-type-tools/cmap-resources
しかし、やはり同じメッセージが表示されてしまいました。
他色々検索しましたが、解決できず、お力添えいただけると幸いです。
pdfcreater └── tfpdf └── unifont └── cmap-resources
補足情報(FW/ツールのバージョンなど)
Mac OS X
lolipop
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。