How to Resolve Cant resolve canvg in jsPDF Integration in Mendix without Node.js

0
Hi Mendix Community, I am working on a Mendix project where I need to generate a PDF from an image using jsPDF. I am using a container that relies on a JavaScript class to capture the image and pages contains graphs convert it into a PDF. The JavaScript file is named jsPDF: Generates the PDF. However, I am encountering the following error when running the project locally: ModuleNotFoundError: Module not found: Error: Can't resolve 'canvg' in 'C:\Users\aman.shukla_infobean\Mendix\MyAppv3-feature_StaticPages_Aman_2\javascriptsource\dashboard\actions' This issue arises because the canvg module is not being found in the environment, and while it works when I manually install npm locally, the problem appears when deploying the project. Since Mendix doesn’t support Node.js dependencies or npm modules, I need to find a solution that avoids using npm altogether. Here are my requirements: No Node.js Dependency: I want to use libraries that work in a browser environment, so no need for Node.js or npm. No npm Modules: I don’t want to install npm modules. Instead, I want to include precompiled versions of libraries directly. Pure Client-Side Execution: The JavaScript should run entirely client-side (in the browser), in line with Mendix's model-driven framework. Could anyone suggest how I can integrate jsPDF or similar libraries into my Mendix project without running into this error? How can I resolve the dependency issue with canvg and generate PDFs purely client-side? Thank you in advance for your help!
asked
0 answers