JSPDF Libary fails

Hello there,

I am in need of some assistance with a Webflow project that was previously owned by a colleague who is no longer with us. I have been tasked with adding a button that downloads the webpage as a PDF, essentially creating a downloadable exposé. So far, I have managed to obtain the button with its ID and have written custom code for it. However, I am encountering an error that says “uncaught referenceerror: jspdf is not defined” when attempting to load the jspdf library.

I am relatively new to Webflow and unsure of how to proceed with resolving this issue. Any suggestions or advice on how to properly load the jspdf library would be greatly appreciated. Thank you in advance for your help.

The Custom Code without an added Libary is Working. Only in Use with this or other libarys doesent work…

<head>
  <!-- Einbindung der jspdf-Bibliothek -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js"></script>
  
  <!-- Einbindung des CSS-Codes -->
  <style>
    ::selection {
      background: #e07a5f; /* WebKit/Blink Browsers */
      color: #ffffff;
    }
    ::-moz-selection {
      background: #e07a5f; /* Gecko Browsers */
      color: white;
    }

    /*width*/
    ::-webkit-scrollbar {
      width: 8px;
    }

    /*track*/
    ::-webkit-scrollbar-track {
      background: rgb(51, 51, 51);
    }

    /*thumb*/
    ::-webkit-scrollbar-thumb {
      background: rgb(224, 122, 95);
      border-radius: 4px;
    }
  </style>

  <!-- Einbindung des JavaScript-Codes -->
  <script>
    // Handler für Klicken auf den Button "expose_download"
    $('#expose_download').click(function() {
      // Erstellen einer neuen jsPDF-Instanz
      var pdf = new jsPDF();

      // Einfügen des HTML-Codes der aktuellen Seite als PDF-Element
      pdf.html(document.body, {
        callback: function () {
          // Speichern der PDF-Datei mit dem Namen "expose.pdf"
          pdf.save('expose.pdf');
        }
      });
    });
  </script>
</head>