I am working on a blazorWebAssmebly project.
I want to convert html to pdf, for that I am using jsPDF ( javascript).
function generatePDF() {
const element ="here_I_want_to_read_the_Html_file"; //
var opt = {
margin: 1,
filename: 'html2pdf_example.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
// Choose the element that our invoice is rendered in.
html2pdf().set(opt).from(element).save();
}
The folder structre
-wwwroot
-js
-generatePDF.js
-html
-pdfTempltor.html
How can I read the html file inside javaScript file