This simple web is to test jspdf.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> creando pdfs</title>
<link rel="stylesheet" href="">
<script src="js/jspdf.js"></script>
<script src="js/FileSaver.js"></script>
</head>
<body>
<h1> creando un pdf</h1>
<script>
function creapdf(){
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');
doc.save('test.pdf');
}
</script>
<a href="javascript:creapdf()">Download PDF</a>
</body>
</html>
It returns an error. saveAs
is not defined.
I have seen this answer that seems to solve the problem link
However, although I have lincada the libraries
<script src="js/jspdf.js"></script>
<script src="js/FileSaver.js"></script>
continues to return the error.