Html2canvas without internet access

Hello, as i wrote in the title i would like to use html2canvas without internet access, i wanted to use again a code for a template that i already have but it works only with internet access because it uses:

<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.3.1/jspdf.umd.min.js"></script>

how can i achieve the same result without internet access? i tried to paste inside

<script>... </script>

the whole file present in https://html2canvas.hertzen.com/dist/html2canvas.min.js but it doesn't seem to work, thanks you

Where did you put it?

Assuming you are using node-red-dashboard (legacy) or @flowfuse/node-red-dashboard you can add that to a template node and it will add html2canvas to the `window object

It is much better to grab copies of the files from the Internet and then put them manually into a folder that you then define that folder in settings.js to be the httpStatic folder.

Having done that, you can change the existing script links to point to the static url in node-red.

Just remember to update the files occasionally from the Internet current versions.

I think that i don't have access to setting.js with my version of nodered (for ctrlx) this is why i was trying others solutions

I copied the whole .js file and paste it inside in a template node of the dashboard in which i have written the code to add the download button and all the code to generate the pdf to download

I tested putting the full code in a dashboard 2 (@flowfuse/node-red-dashboard) ui-template node between <script>...</script> tags & the html2canvas function was available in the window object (i.e. it does work).

I havent tried with a ui_template on legacy dashboard (the older node-red-dashboard)

I usually create an http endpoint for this that serves the javascript files which can be included with <script src='....' />

if you are serving via http nodes as an endpoint, you should be serving the js without the script tags and add a content-type header set to application/javascript