Take a look at these links:
javascript - Convert canvas to PDF - Stack Overflow A complete guide to generate PDF via just the front-end - Rahul Gaba