Hi,
I want to convert HTML content in PDF format. I am trying to achieve this using javascript. There is a library named jspdf in javascript that fulfills this requirement. But I am not able to use that library. How should I import/install/include jspdf library in javascript code.
I am providing the code that I have written on click of a button. It's throwing jspdf not found error :
var script = document.createElement('script');
script.src = "https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js";
script.onload = function() {
var pdf = new jsPDF();
pdf.text('Hello world!',10, 10);
pdf.save('hello.pdf');
};
document.head.appendChild(script);
Let me know if the logic I am trying to implement is possible by anyway or is there any another method that I can use.
Thank you !
Hi @Ibtesam Shaikh ,You can use this Link
Thanks
Thanks @Harshit Nag, it's working for me!
Hi @Ibtesam Shaikh
You can try the below component
https://www.outsystems.com/forge/component-overview/9873/reactive-html2pdf-js#:~:text=Reactive%20Html2Pdf%20Js%20is%20a,js%20available%20here.
Regards
Krishnanand Pathak
Thanks, I'll check.
Hello Ibtesam Shaikh , I have attached an oml file for your reference, I think it is the same approach you are using but with different JS.
The JS which needs to be uploaded :Javascript to download
Please look into it.
Regards Neha
Please mark as a solution if you got one.
I have attached an oml file for your reference.
Please check if its matching your use case.
Thanks.