Character Text to HTML

So I have tried using jsPDF but I have tried fixing the errors but the code doesn’t recognise jsPDF

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Generate PDF jsPDF</title>
</head>

<body>
    <button id="button" onclick="pdf()">Create PDF</button>
</body>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script>
    function pdf() {
        var doc = new jsPDF()
        doc.text('hello, world!', 10, 10)
        doc.save('output.js')
    }
</script>

</html>

Tried changing where the function started but it still doesn’t wanna play ball.