iT邦幫忙

0

tcpdf 自動換行bug

目前小弟使用tcpdf遇到了會自動換行的bug,想請問有甚麼方法可以解決嗎(好像看不出甚麼邏輯)
https://drive.google.com/file/d/1wZho_h_ILwiSWEvUpU5HZlZvvpkf5rAp/view?usp=sharing
7000.00和1000的地方都自動斷行了
以下部分程式碼

$txt0 = <<<EOD
<style>
</style>

<p>承租人每月租金為新臺幣(下同)
<span class="contract h-card"><span class="monthly_rental_amount">5000</span></span>
元整,每期應繳納
<span class="contract h-card"><span class="rent_payment_frequency">繳納租金週期(月)</span></span>
個月租金,並於每月
<span class="contract h-card"><span class="payment_due_date">7000.00</span></span>
日前支付,不得藉任何理由拖延或拒絕;出租人亦不得任意要求調整租金。
</p>
<p>擔保金(押金)由租賃雙方約定為
<span class="contract h-card"><span class="security_deposit_amount">1000</span></span>
元整(最高不得超過二個月房屋租金之總額)。承租人應於簽訂本契約之同時給付出租人。
</p>

EOD;
$pdf->writeHTML($txt0, true, false, true, false, '');
淺水員 iT邦大師 6 級 ‧ 2020-09-24 15:03:49 檢舉
把中文字看成沒有空白的英文字母連在一起,就不會覺得他的換行很奇怪了。
參考看看 https://tcpdf.org/examples/example_005/ 吧,Multicell 也許可以解決一些問題。
(不是很確定)
fillano iT邦超人 1 級 ‧ 2020-09-25 12:12:51 檢舉
css其實有line-break, word-break...等等,但是要確定tcpdf有支援才有意義。有一個麻煩但是可能的解法,unicode有無寬度的空白字元,把他插在每個中文字之間,他搞不好就會換行了XD
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答