TCPDF 中文字導致空白頁面解決方法 / TCPDF some Non-ASCII character causing writeHTML empty output

最近使用TCPDF 遇到 writeHTML / writeHTMLCell 整個變成空白的 Bug

經自行 Debug 後發現問題出於 getHtmlDomArray(),
部分 preg_replace 會錯誤把部分字元替代錯誤, 最後導致整個HTML Block無效

官方解決前暫時解決方法是 Comment 掉 tcpdf.php 內這兩行

此問題已經回報到 TCPDF SorceForge Bug Tracker
==================================

Recently I encountered a bug in TCPDF, which cause writeHTML / writeHTMLCell output blank when certain characters are inputted.

After debugging by myself, I found that the problem is caused by getHtmlDomArray(),
some preg_replace code will mess up whole HTML block if certain character appeared.

Meanwhile, it can be workaround by commenting out these two lines in tcpdf.php

This bug have been reported to TCPDF SorceForge Bug Tracker

Affected version: 6.2.9
Bug Tracker: https://sourceforge.net/p/tcpdf/bugs/1065/

Leave a Reply

Your email address will not be published.