How to generate report from TEXT INPUT NODES

I have various TEXT INPUT NODES, where operator enters a date , time and Notes.
I would like to save these entries as pdf file, by clicking a button manually. Can someone please guide me how can i do it?

Hi,

as a template try something like this - you will need to install the pdfmaker node and configure your output directory but It should give you the idea

[{"id":"c02ccdc7.046558","type":"ui_text_input","z":"bce50b9f.7a7508","name":"","label":"input_1","tooltip":"","group":"6a4d510d.5de65","order":5,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"topic","topicType":"msg","x":295,"y":2235,"wires":[["fcaff99c.eb07b8"]]},{"id":"34303163.394ea6","type":"ui_text_input","z":"bce50b9f.7a7508","name":"","label":"input_2","tooltip":"","group":"6a4d510d.5de65","order":6,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"topic","topicType":"msg","x":295,"y":2295,"wires":[["ac423f71.53102"]]},{"id":"f668b5a8.218ff8","type":"ui_text_input","z":"bce50b9f.7a7508","name":"","label":"input_3","tooltip":"","group":"6a4d510d.5de65","order":7,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"topic","topicType":"msg","x":295,"y":2370,"wires":[["35ec7c98.9b0cc4"]]},{"id":"fcaff99c.eb07b8","type":"change","z":"bce50b9f.7a7508","name":"","rules":[{"t":"set","p":"input_1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":485,"y":2235,"wires":[["2d8e3b3e.64d304"]]},{"id":"35ec7c98.9b0cc4","type":"change","z":"bce50b9f.7a7508","name":"","rules":[{"t":"set","p":"input_3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":485,"y":2370,"wires":[["2d8e3b3e.64d304"]]},{"id":"ac423f71.53102","type":"change","z":"bce50b9f.7a7508","name":"","rules":[{"t":"set","p":"input_2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":485,"y":2295,"wires":[["2d8e3b3e.64d304"]]},{"id":"2d8e3b3e.64d304","type":"debug","z":"bce50b9f.7a7508","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":675,"y":2295,"wires":[]},{"id":"3d97696e.188756","type":"ui_button","z":"bce50b9f.7a7508","name":"","group":"6a4d510d.5de65","order":3,"width":0,"height":0,"passthru":false,"label":"Create PDF","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":320,"y":2475,"wires":[["55c2c5fd.40eef4"]]},{"id":"55c2c5fd.40eef4","type":"function","z":"bce50b9f.7a7508","name":"Format PDF","func":"let input_1 = flow.get(\"input_1\")\nlet input_2 = flow.get(\"input_2\")\nlet input_3 = flow.get(\"input_3\")\n\nlet content  = `The report could look like this data from input 1 was ${input_1} \\\nand the data from input 2 was ${input_2} and three was ${input_3}`\n\nmsg.payload  = { content: content };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":475,"y":2475,"wires":[["79a078dd.fa16e"]]},{"id":"79a078dd.fa16e","type":"pdfmake","z":"bce50b9f.7a7508","name":"","outputType":"base64","inputProperty":"payload","options":"{}","outputProperty":"payload","x":630,"y":2475,"wires":[["6ea895dc.3fe594"]]},{"id":"6ea895dc.3fe594","type":"file","z":"bce50b9f.7a7508","name":"","filename":"/data/report.pdf","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"base64","x":800,"y":2475,"wires":[["577a1288.5cf2bc"]]},{"id":"577a1288.5cf2bc","type":"debug","z":"bce50b9f.7a7508","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":985,"y":2475,"wires":[]},{"id":"6a4d510d.5de65","type":"ui_group","name":"Users","tab":"56715436.c2591c","order":2,"disp":true,"width":"9","collapse":false},{"id":"56715436.c2591c","type":"ui_tab","name":"Home Tab","icon":"dashboard","order":3}]

The pdfmake node is pretty cool and you can set up format based on JSON. Alternatively we have formatted a document as HTML and then used as html to pdf node, but to get you going try that

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.