Good morning, I have been looking for a way to take or remove the image of a chart from my dashboard and have that image inserted into the structure of the PDF that I am putting together, I have searched for information and nothing in particular has helped me with what I want to achieve. do,
I wanted to ask you if you had any knowledge of this process that you could share with me since I made a flow that crashed the node red and I had to format it, I am from scratch, I have used the node-red-contrib-web-page-screenshot library, but It crashes when it is with ID or Class, and without selecting normal it only takes a gray screen,
I apologize for the inconvenience in advance and I appreciate any possible documentation you may provide me with.
Did you try a forum search,? There was a question like this asked in the past few days.
If I explored most of the forum with those solutions, some do not fit what I am looking for or want to achieve and other topics are still not resolved and are like me, that is why I proceeded to open a topic to see if anyone else would have any information on another page, to gather documentation, sorry for the inconvenience.
- what version of Node-red and node.js are you using?
- what platform are you running NR on?
If I understand you, you currently have a graph on your dashboard but you want to put that chart in a pdf. This might help you Generate chart images in Node-Red for email or chat messages (flow) - Node-RED
It might be worth a try to see if you can adapt it for what you want to do.
I was not able to take a screenshot of a specific flow but I was able to take a screenshot of the entire dashboard, which for me is something, thanks to you for the information provided my dear colleague, I share the example flow with you, it is not very well organized but it works perfectly, in case anyone is looking for a solution that will help them,
What I did was convert the screenshot into base64 and store it in a global variable, and in the pdf format that I have, I called the global variable so that I could attach it there, without further ado, I would like to thank you for your help.
flow:
[
{
"id": "fa1432119f33bbfb",
"type": "inject",
"z": "67c61941.053d58",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 420,
"y": 1500,
"wires": [
[
"08d8e18d7ce7c0ee"
]
]
},
{
"id": "08d8e18d7ce7c0ee",
"type": "puppeteer-browser-launch",
"z": "67c61941.053d58",
"timeout": "7000",
"slowMo": 0,
"headless": true,
"debugport": 0,
"devtools": false,
"cookies": "",
"name": "",
"x": 620,
"y": 1500,
"wires": [
[
"2671441d86f84188"
]
]
},
{
"id": "e17eeca2886e7d9e",
"type": "puppeteer-page-goto",
"z": "67c61941.053d58",
"name": "LINK",
"url": "http://127.0.0.1:1880/ui/#!/21?socketid=H38GHI0t_eSHpxjMAAAL",
"urltype": "str",
"waitUntil": "networkidle2",
"x": 610,
"y": 1380,
"wires": [
[
"89479f5b9ca016a9"
]
]
},
{
"id": "89479f5b9ca016a9",
"type": "puppeteer-page-screenshot",
"z": "67c61941.053d58",
"name": "",
"fullpage": true,
"x": 130,
"y": 1240,
"wires": [
[
"363b82550dbd1544",
"65ba01c8108db452"
]
]
},
{
"id": "2671441d86f84188",
"type": "puppeteer-page-viewport",
"z": "67c61941.053d58",
"name": "",
"width": "1920",
"height": "1000",
"scale": 1,
"x": 620,
"y": 1440,
"wires": [
[
"e17eeca2886e7d9e"
]
]
},
{
"id": "3749cf6b2b9cbcea",
"type": "puppeteer-browser-close",
"z": "67c61941.053d58",
"name": "",
"x": 820,
"y": 1320,
"wires": [
[
"029730d8083b07b0"
]
]
},
{
"id": "363b82550dbd1544",
"type": "function",
"z": "67c61941.053d58",
"name": "Select Last Value",
"func": "msg.topic = \"SELECT * FROM plc.oee_kpi ORDER BY Fecha DESC LIMIT 1;\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 170,
"y": 1400,
"wires": [
[
"ba45e10e55eb771c"
]
]
},
{
"id": "ba45e10e55eb771c",
"type": "mysql",
"z": "67c61941.053d58",
"mydb": "fb05e811b8b0da75",
"name": "",
"x": 330,
"y": 1400,
"wires": [
[
"33f2686f507a65bb"
]
]
},
{
"id": "33f2686f507a65bb",
"type": "function",
"z": "67c61941.053d58",
"name": "FORMATO DE TABLA",
"func": "//datatime\nvar time = new Date().toLocaleString(\"co\");\nvar imagePath = global.get('image')\n\n\t// Ahora 'data' contiene el contenido de la imagen en un Buffer\n\n//Average/Valor Promedio\nvar a = msg.payload[0][\"Tipodefalla\"];\nvar b = msg.payload[0][\"Turno\"];\nvar c = msg.payload[0][\"Tiemposdeparada\"];\nvar d = msg.payload[0][\"Tiemposdereparacion\"];\nvar e = msg.payload[0][\"Tiempodearranque\"];\n\n\n\nmsg.payload = {\n\tpageOrientation: 'LANDSCAPE',\n\tcontent: [\n\t\t{\n\t\t\timage: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxIPEBUSEBAVFRUWFxgXFxcXFRUVFxgYFhUWFhUVFxgYHSggGBonHRYXITIhJikrLi8uGB8zODMsNygtLisBCgoKDg0OGxAQGy8lICYrMi0tLTctLi0tLS0tLS0tLS0vLS8tLS0tLS01LS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIAHIBuwMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABQYBBAcDAv/EAEUQAAEDAQQECQoEBAYDAQAAAAEAAhEDBBIhMQUGQVEWIlJhcYGRkrITMjM0U3JzobHBBxRC0RUjwtJDYoKi4fBUs/Ek/8QAGgEAAgMBAQAAAAAAAAAAAAAAAAQBAgMFBv/EADURAAIBAgMEBwgCAgMAAAAAAAABAgMRBCExEkFRkRQyYXGh0fAFEyIzUoGxwRXhQvEjJDT/2gAMAwEAAhEDEQA/AOuaU05Rszg2qXSRMBpOExj8+xanC+y739wqB/ED1hnwx4nqsrm1sXONRxVshadWSk0jonC+y739wpwvsu9/cK52iy6bU7OX9lffyOicL7Lvf3CthuslnOTiehpXM19UapYZH/1RLG1rZW5f2WjXe86Zwhocp3dKcIaHKd3Sqcx14AjIrKX/AJOv2cn5jFy4cIKG93dK3LbbGUWhzyYJgQJVDKtetfom+99imaOOqzpVJO14pW+9+3sJPXhDQ5Tu6VjhBQ3u7pVQRLfylfs5PzAttTWSg3ZUPQwleHDCy739wqtrwtFnDxjnsKtH2pV3pcn5lJbW4tfC+y739wr7o612Vxi+5vO5rgFzmrTLSQc1hbrHVOzl/Zh76R1uy2unWaH03hzTtH0O48xWyuR2C3VLO+/SddO3cQDMEbQul6F0m21URUEA5ObM3Xbvv1p3D4lVcnkzWnUUst5m2aVpUXXXkzE4AnNeP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2drLu7vIOmxvtbOffuz88yE1VdJq8drvMyZcjz88BKsS8qdJrfNaBO4AfReqcpQcIKLd+fG++78ROrNTm5JfjhbdZeAREWhmEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAf/2Q==',\n\t\twidth:50},\n\t\t{text: 'Curso: Interfaz MySQL con PLC vĂa Node-RED', style: 'header'},\n\t\t{text: 'Tema: GeneraciĂłn de Informes en pdf', style: 'header'},\n\t\t{text:'Reporte generado el: '+time+' \\n\\n' },\n\t\t\n\t\t'Ahora puede generar informes personalizados de sus datos en Node-RED. Este es solo un informe de muestra generado para explicar la funciĂłn. Se puede personalizar el informe segĂşn sus preferencias.',\n\t\t{text: 'Valores del mundo real de la tabla de la base de datos MySQL llamada `plc.tanklevel`', style: 'subheader'},\n\t\t'La siguiente tabla muestra los valores provenientes del PLC',\n\t\n\t {text: 'Valores PLC', style: 'subheader'},\n\t\t{\n\t\t\tstyle: 'tableExample',\n\t\t\ttable: {\n\t\t\t\tbody: [\n\t\t\t\t\t[{text:'OEE_ME', style: 'tableHeader'}, {text:'RECHAZO', style: 'tableHeader'}, {text:'ENERGIA_ACTUAL', style: 'tableHeader'}, {text:'AIRE_ACTUAL', style: 'tableHeader'},{text:'GAS_ACTUAL', style: 'tableHeader'}],\n\t\t\t\t\t[\"\"+a+\"\", \"\"+b+\"\", \"\"+c+\"\",\"\"+d+\"\",\"\"+e+\"\"]\n\n\t\t\t\t\n\t\t\t\t]\n\t\t\t},\n\t\t\t\n\t\t},\n\t\t{\n\t\t\timage: 'data:image/jpeg;base64,\"'+imagePath+'\"',\n\t\t\twidth: 700\n\t\t},\n\t\t\t\t\t\t\n\t\t\n\t\t\n\t\t\n\t\t{text: 'Hardware usado', style: 'subheader'},\n\t {\n\t\t\tul: [\n\t\t\t\t{text: 'Siemens S7-1200 con OPC UA'},\n\t\t\t\t{text: 'PLC Ethernet cable'},\n\t\t\t\t{text: '24VDC Power supply'},\n\t\t\t]\n\t\t},\n\t\t\n\t\t\t{text: 'Software usado', style: 'subheader'},\n\t {\n\t\t\tul: [\n\t\t\t\t{text: 'TIA Portal v17'},\n\t\t\t\t{text: 'IOT', color: 'purple'},\n\t\t\t\t//{text: 'Prototipo'},\n\t\t\t]\n\t\t},\n\t\t\n\t\t/*{text: 'VisĂtenos (Hipervinculado)', style: 'header'},\n\t\t{\n\t\t\tul: [\n\t\t\t\t//{text: 'Escuela de aprendizaje electrĂłnico', color: 'purple' ,link: 'http://learn.codeandcompile.com' },\n\t\t\t\t{text: 'YouTube', color: 'purple', link: 'https://www.youtube.com/channel/UC4rqWPxMnjbOAhKfbse-5Wg/featured' },\n\t\t\t\t{text: 'Instagram', color: 'purple', link: '' },\n\t\t\t]\n\t\t},*/\n\t\t\t{\n\t\t\ttext: '\\n Este documento se genera Ăşnicamente con fines de capacitaciĂłn. Los datos dentro de este documento no provienen de ninguna fuente comprometida. Para cualquier informaciĂłn contactar con Soporte',\n\t\t\tstyle: ['quote', 'small']\n\t\t}\n\n\n ],\n \tstyles: {\n\t\theader: {\n\t\t\tfontSize: 18,\n\t\t\tbold: true,\n\t\t\tmargin: [0, 0, 0, 10]\n\t\t\t\n\t\t},\n\t\tsubheader: {\n\t\t\tfontSize: 16,\n\t\t\tbold: true,\n\t\t\tmargin: [0, 10, 0, 5]\n\t\t},\n\t\ttableExample: {\n\t\t\tmargin: [0, 5, 0, 15],\n\t\t\talignment: 'center'\n\t\t},\n\t\ttableHeader: {\n\t\t\tbold: true,\n\t\t\tfontSize: 13,\n\t\t\tcolor: 'black'\n\t\t},\n\t\t\tquote: {\n\t\t\titalics: true\n\t\t}\n \t}\n};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 1240,
"wires": [
[
"0666a43e7b8d954e"
]
]
},
{
"id": "029730d8083b07b0",
"type": "file",
"z": "67c61941.053d58",
"name": "",
"filename": "C:\\Users\\Cristian Torres\\Desktop\\Reportes\\Informe.pdf",
"filenameType": "str",
"appendNewline": true,
"createDir": true,
"overwriteFile": "true",
"encoding": "none",
"x": 1000,
"y": 1240,
"wires": [
[]
]
},
{
"id": "0666a43e7b8d954e",
"type": "pdfmake",
"z": "67c61941.053d58",
"name": "",
"outputType": "Buffer",
"inputProperty": "payload",
"options": "{}",
"outputProperty": "payload",
"x": 660,
"y": 1240,
"wires": [
[
"029730d8083b07b0"
]
]
},
{
"id": "585ccd1f08c8c921",
"type": "function",
"z": "67c61941.053d58",
"name": "function 199",
"func": "global.set('image', msg.payload)\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 450,
"y": 1200,
"wires": [
[]
]
},
{
"id": "65ba01c8108db452",
"type": "base64",
"z": "67c61941.053d58",
"name": "",
"action": "",
"property": "payload",
"x": 260,
"y": 1200,
"wires": [
[
"585ccd1f08c8c921"
]
]
},
{
"id": "fb05e811b8b0da75",
"type": "MySQLdatabase",
"name": "",
"host": "127.0.0.1",
"port": "3306",
"db": "plc",
"tz": "",
"charset": "UTF8"
}
]
Note: this flow uses puppet which uses chrome or chromium so if you plan to use this same flow in a different browser it will not work for you.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.