I am using jspdf's html()
method to convert an HTML string of an invitation to pdf.
The problem is that I don't know how to set the content height to fit in one pdf page, cause the generated pdf get split if the height is bigger than the pdf height and it's not looking good for an invitation.
Here is my code:
const doc = new jspdf('p', 'pt', 'a4');
let docWidth = doc.internal.pageSize.getWidth();
const htmlString = row.content;
await doc.html(htmlString, {
callback: function(doc) {
doc.save('file.pdf');
},
autoPaging: 'text',
margin: [0, 0, 0, 0],
width: docWidth,
windowWidth: 1000,
})