我创建了JavaScript代码以从HTML后端获取数据并将该HTML转换为PDF。
为了生成PDF,我使用了JSPDF。
我的HTML字符串如下所示:
"
Dear [@Client Name],
This is a sample letter that I need filled out for [@Client Name 2], who lives in [@City],[@Province]. On this date, the [@Number Date], of [@Month],[@Year]. It occurred to me that [@Client Name] was talking to [@Client Name 3].
The end.
Appriciate your time.
[@Date]
"使用JSPDF生成的PDF如下所示:
生成HTML的代码是:
function GeneratePDF(content) {
var doc = new jsPDF();
var specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
doc.fromHTML(content, 15, 15, {
'width': 250,
'elementHandlers': specialElementHandlers
});
doc.save('sample-file.pdf');
}
您能否指导我如何管理对齐以管理内容。另外,如何管理字体以及如何删除þÿ字符?