1
我有一个基本的可观察对象,其中包含一个文本,其中有换行符。fpdf换行符不起作用
像这样:
var str += item.first_name + " " + item.last_name + "," + item.occupation + "\n\n";
str += "RE :" + item.first_name + " " + item.last_name + ", DOB: "
+ item.date_of_birth + "\n";
text = ko.observable(str);
,我使用来显示字符串的方法是:
$pdf->MultiCell(0,8,$text);
,我在我的PDF得到的结果是:
Dr. Bart grahamson,MBBSRE :Jack Junior, DOB: 1985-01-02
什么是捕捉这些换行符的方法?
你能告诉我们'$ text'的输出吗? – Rikesh 2013-04-25 15:38:38
我已经展示了它 – Stranger 2013-04-25 15:39:12
你如何从你的js变量 - >'text = ko.observable(str);'到你的php变量 - >'$ text'?可能是因为js已经解析了换行符\ n,所以它不再以fpdf方法使用的格式。如果换行符总是在同一个位置,您可以重新插入 - >'$ pdf-> MultiCell(0,8,preg_replace(“(RE :)”,“\ n \ n”。“\ $ {1} “,$ test)。”\ n“);' – Sean 2013-04-25 21:40:12