# How to generate report from TEXT INPUT NODES

**URL:** https://discourse.nodered.org/t/how-to-generate-report-from-text-input-nodes/44034
**Category:** Dashboard
**Created:** [12 April 2021 13:50 UTC](https://discourse.nodered.org/t/how-to-generate-report-from-text-input-nodes/44034 "2021-04-12T13:50:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PinPat](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@PinPat](https://discourse.nodered.org/u/PinPat)
#### Post date: [12 April 2021 13:50 UTC](https://discourse.nodered.org/t/how-to-generate-report-from-text-input-nodes/44034/1 "2021-04-12T13:50:28Z")

</div>

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?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/2/c2e79ff5f7601cde2c12d9c0e4edf8ce46a291a6.png)

---

<div class="post-metadata">

### Author: ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)
#### Post date: [13 April 2021 00:16 UTC](https://discourse.nodered.org/t/how-to-generate-report-from-text-input-nodes/44034/2 "2021-04-13T00:16:02Z")

</div>

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

 ![Screen Shot 2021-04-13 at 10.13.24 am](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bcfb84e949088e0a1a8aec7f1c9c1c32e2b31441.png)

```auto
[{"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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [13 May 2021 00:16 UTC](https://discourse.nodered.org/t/how-to-generate-report-from-text-input-nodes/44034/3 "2021-05-13T00:16:17Z")

</div>

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