我正在我的程序中使用 overFlow : linebreak
. 它工作正常这是我的代码,
styles: {
fillStyle: 'DF',
overflow: 'linebreak',
columnWidth: 110,
lineWidth: 2,
lineColor: [85, 51, 27]
}
但这并没有反映在 beforePageContent
里面,这是代码,
beforePageContent: function(data) {
doc.setFontSize(12);
doc.setFont("courier");
doc.text("Process Name :",20 ,15);
doc.setFontStyle('bold');
//doc.overflow('linebreak');
doc.setFontStyle('normal');
doc.text("Description :"+sampData, 20, 30);
},
那我怎么能在 beforePageContent
块中使用 lineBreak
.
1 回答
overflow: linebreak;
样式仅适用于jspdf-autotable
. 在钩子(例如beforePageContent)中,您使用纯jspdf并且需要使用jspdf方法 . 有两个功能你可能会有所帮助 . 第一个是doc.getStringUnitWidth("hello")
,第二个是doc.splitTextToSize("A longer title that might be split", 50)
.Example 1:
Example 2: