任何人都对froala编辑器有任何了解。我可能会用它来编辑网页并将其生成为PDF。 HTML模板包含动态数据,当我生成PDF时,内容之间会发生分页符,这看起来很糟糕。有人知道如何解决吗?
答案 0 :(得分:0)
您可以创建一个自定义按钮并在回调中修改html2pdf插件。
FroalaEditor.DefineIcon('customDownload', {
NAME: 'plus',
SVG_KEY: 'add'
});
FroalaEditor.RegisterCommand('customDownload', {
title: 'Custom Download PDF',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function() {
var element = this.el;
var opt = {
margin: 1,
filename: 'myfile.pdf',
image: {
type: 'jpeg',
quality: 0.98
},
html2canvas: {
scale: 2
},
jsPDF: {
unit: 'in',
format: 'A4',
orientation: 'portrait'
},
pagebreak: {
mode: 'avoid-all',
before: '#page2el'
}
};
html2pdf(element, opt);
}
});
new FroalaEditor('#selector', {
toolbarButtons: ['customDownload']
});