I am trying to print the info shown in angular material wizard in pdf format, I have tried to use jspdf but it is not working, it is giving this error:
You need either https://github.com/niklasvh/html2canvas or https://github.com/cburgmer/rasterizeHTML.js
The code I am using is:
const elementToPrint = document.getElementById('completed'); // The html element to become a pdf
const pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML(elementToPrint, () => {
pdf.save('web.pdf');
});
I have already installed html2canvas using npm & I am importing it in the same ts file.
What is causing that error ?
The same code above works fine if I include this script in the index file
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
But it prints pdf with very low quality, as if it used a pixelated snapshot of the div that I am capturing
Is there something better suited for this task than jsPdf? as I didn't find any similar library, I found some libraries on npm for angularJS but not angular2+, I am searching for some library so that I can build the pdf document:
1- From multiple divs (the wizard steps)
2- Make a pdf client side that include the info of the wizard.
3- Should be of high quality (not pixelated)
Example for a good quality tool that I found only in AngularJS