fpdf line break not working

主宰稳场 提交于 2019-12-11 05:34:25

问题


I have a knockout observable which contains a text that has line breaks in it.

Like this:

 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); 

The method that I am using to display the string is:

$pdf->MultiCell(0,8,$text);

The result that I get in my pdf is :

 Dr. Bart grahamson,MBBSRE :Jack Junior, DOB: 1985-01-02

What is a way to catch those line breaks?


回答1:


Use \n and \r.

var  str += item.first_name +  " " + item.last_name + "," + item.occupation + "\n \r\r \n"; 
 str += "RE :" + item.first_name +  " " + item.last_name + ", DOB: "
                            + item.date_of_birth + "\n \r"; 
text = ko.observable(str); 


来源:https://stackoverflow.com/questions/16218997/fpdf-line-break-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!