Thanks to @dumy for it's guides you can find it here:
https://flows.nodered.org/flow/482d3b2c9736fc1544dd62b50778d8d9
I have made some changes to export the page in "Dark mode" and i have added some "tutorials" for Puppeteer
Requisites:
-node-red-contrib-string - https://flows.nodered.org/node/node-red-contrib-string
-Puppeteer
This can be installed with
npm i puppeteer
Than you have to go to your node-red installation folder and change settings.js and add this line
puppeteer:require('puppeteer')
under "functionGlobalContext"
Setup:
In setting dashboard go to the module link and set link from Node-Red ❤️ N.B. Remeber to flag "Include current time range"
http://localhost:1880/grafana/${__dashboard.uid}/${__dashboard.name}
Change "localhost:1880" with your ip/dns
Resulted:
When you click the button this flow will be executed:
In the node function there are 3 parameters that needs to be change:
// URL to load should be passed as first parameter const url = 'http://localhost:3000/d/' + msg.req.params.uid + '/' + msg.req.params.name +'?orgId=1&kiosk&from=' + msg.payload.from + '&to=' + msg.payload.to;
// Username and password (with colon separator) should be second parameter const auth_string = 'username:password!';
// Output file name should be third parameter const outfile = '';
After call the link resulted in pdf
it is a simple method to export grafana pages in pdf,
Thank you ✌️
am I missing something here? It should work, shouldnt it?