rename it from .pdf to .js
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Hello world</title> </head> <body> <h1>Hello world</h1> <script type="text/javascript" src="jspdf.debug.js"></script> <script type="text/javascript"> // https://www.sitepoint.com/generating-pdfs-from-web-pages-on-the-fly-with-jspdf/ var pdf = new jsPDF(); pdf.text(30, 30, 'Hello world!'); pdf.text(40, 40, 'Another line!'); pdf.save('hello_world.pdf'); </script> </body> </html>