I was using below mentioned JavaScript function for export HTML to PDF, even though. css and splitting the page as of break also not working. can anybody help me to solve this issue.
function generatePDF() {
var doc = new jsPDF(); //create jsPDF object
doc.fromHTML(document.getElementById("divMainScreen"), // page element which you want to print as PDF
15,
15,
{
'width': 170 //set width
},
function (a) {
doc.save("VehicleInspection.pdf"); // save file name as VehicleInspection.pdf
});
}
HTML:
<div id="divHeader">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="red" class="bi bi-caret-right-fill" viewBox="0 0 16 16">
<path d="m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z" />
</svg>
<i class="bi bi-caret-right-fill"></i><font>DATE : 08/09/2021</font>
</div>
<div style="break-inside:avoid;page-break-inside:avoid;"></div>//--USING FOR BREAK PAGE
<div id="divThree">
//--Body Content
</div>