# Pass an html template to pdf, any ideas?

**URL:** <https://discourse.nodered.org/t/pass-an-html-template-to-pdf-any-ideas/63536>\
**Category:** General\
**Created:** [6 June 2022 22:21 UTC](https://discourse.nodered.org/t/pass-an-html-template-to-pdf-any-ideas/63536 "2022-06-06T22:21:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LilGrundy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lilgrundy/32/87875_2.png) [@LilGrundy](https://discourse.nodered.org/u/LilGrundy)\
**Post date:** [6 June 2022 22:21 UTC](https://discourse.nodered.org/t/pass-an-html-template-to-pdf-any-ideas/63536/1 "2022-06-06T22:21:33Z")

</div>

Good morning to the entire node red community, I am new to this, as you will see I am learning from node red, and of course I have a question, I have a template of an html table that I use to view some data from my mysql, and I want to convert those same table to pdf, but I can't make it take the range of data that I wanted, it only picks one row, does anyone have any idea how to make it go from html, as I say I'm still learning and it's part of my practice, I would like to know your opinions, greetings to all and a hug.

in case you want to review this is my flow:

```auto
[
    {
        "id": "619ad3d9eee698c2",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "86e33cefbcccd463",
        "type": "ui_date_picker",
        "z": "619ad3d9eee698c2",
        "name": "",
        "label": "Inicio",
        "group": "bd91d6d28d4a7275",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "topic": "",
        "topicType": "str",
        "className": "",
        "x": 110,
        "y": 160,
        "wires": [
            [
                "e1674f835c06592a",
                "ac9359a706cb2172"
            ]
        ]
    },
    {
        "id": "ac9359a706cb2172",
        "type": "moment",
        "z": "619ad3d9eee698c2",
        "name": "",
        "topic": "",
        "input": "payload",
        "inputType": "msg",
        "inTz": "America/Bogota",
        "adjAmount": "1",
        "adjType": "days",
        "adjDir": "subtract",
        "format": "",
        "locale": "es_ES",
        "output": "payload",
        "outputType": "msg",
        "outTz": "America/Bogota",
        "x": 340,
        "y": 160,
        "wires": [
            [
                "d1f1debeb2a4f7ec",
                "63ed3bf3dc2e3de2"
            ]
        ]
    },
    {
        "id": "d1f1debeb2a4f7ec",
        "type": "debug",
        "z": "619ad3d9eee698c2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 510,
        "y": 80,
        "wires": []
    },
    {
        "id": "e1674f835c06592a",
        "type": "debug",
        "z": "619ad3d9eee698c2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 190,
        "y": 80,
        "wires": []
    },
    {
        "id": "63ed3bf3dc2e3de2",
        "type": "string",
        "z": "619ad3d9eee698c2",
        "name": "",
        "methods": [
            {
                "name": "left",
                "params": [
                    {
                        "type": "num",
                        "value": "10"
                    }
                ]
            }
        ],
        "prop": "payload",
        "propout": "payload",
        "object": "msg",
        "objectout": "msg",
        "x": 570,
        "y": 160,
        "wires": [
            [
                "cfa668d69d7677a5",
                "647cbe381f9e49c8"
            ]
        ]
    },
    {
        "id": "cfa668d69d7677a5",
        "type": "debug",
        "z": "619ad3d9eee698c2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 100,
        "wires": []
    },
    {
        "id": "647cbe381f9e49c8",
        "type": "function",
        "z": "619ad3d9eee698c2",
        "name": "",
        "func": "var date1= msg.payload;\nvar date2= date1 +\" 00:00:00\";\nglobal.set('Inicio',date2);\nmsg.payload=date2;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "271c2cc9be54b0ef",
        "type": "ui_date_picker",
        "z": "619ad3d9eee698c2",
        "name": "",
        "label": "Final",
        "group": "bd91d6d28d4a7275",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "topic": "",
        "topicType": "str",
        "className": "",
        "x": 110,
        "y": 220,
        "wires": [
            [
                "8c684312f0964f72"
            ]
        ]
    },
    {
        "id": "8c684312f0964f72",
        "type": "moment",
        "z": "619ad3d9eee698c2",
        "name": "",
        "topic": "",
        "input": "payload",
        "inputType": "msg",
        "inTz": "America/Bogota",
        "adjAmount": "1",
        "adjType": "days",
        "adjDir": "subtract",
        "format": "",
        "locale": "es_ES",
        "output": "payload",
        "outputType": "msg",
        "outTz": "America/Bogota",
        "x": 340,
        "y": 220,
        "wires": [
            [
                "a51d5f3b34a99682"
            ]
        ]
    },
    {
        "id": "a51d5f3b34a99682",
        "type": "string",
        "z": "619ad3d9eee698c2",
        "name": "",
        "methods": [
            {
                "name": "left",
                "params": [
                    {
                        "type": "num",
                        "value": "10"
                    }
                ]
            }
        ],
        "prop": "payload",
        "propout": "payload",
        "object": "msg",
        "objectout": "msg",
        "x": 570,
        "y": 220,
        "wires": [
            [
                "57d99656df049a0f"
            ]
        ]
    },
    {
        "id": "57d99656df049a0f",
        "type": "function",
        "z": "619ad3d9eee698c2",
        "name": "",
        "func": "var date1= msg.payload;\nvar date2= date1 +\" 23:59:59\";\nglobal.set('Final',date2);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 760,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "a8a2a1a9e3f660ac",
        "type": "debug",
        "z": "619ad3d9eee698c2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 710,
        "y": 280,
        "wires": []
    },
    {
        "id": "65163045a5f2b7f2",
        "type": "ui_button",
        "z": "619ad3d9eee698c2",
        "name": "",
        "group": "bd91d6d28d4a7275",
        "order": 8,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Filtrar",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "topicType": "str",
        "x": 110,
        "y": 340,
        "wires": [
            [
                "ac970b42137fc67c"
            ]
        ]
    },
    {
        "id": "a228b337854168ee",
        "type": "comment",
        "z": "619ad3d9eee698c2",
        "name": "Ordenar Datos",
        "info": "",
        "x": 120,
        "y": 40,
        "wires": []
    },
    {
        "id": "fc79d95366bd9799",
        "type": "mysql",
        "z": "619ad3d9eee698c2",
        "mydb": "fb05e811b8b0da75",
        "name": "",
        "x": 490,
        "y": 340,
        "wires": [
            [
                "a8a2a1a9e3f660ac",
                "4ba0e4585c7a12ae"
            ]
        ]
    },
    {
        "id": "ac970b42137fc67c",
        "type": "function",
        "z": "619ad3d9eee698c2",
        "name": "",
        "func": "var from = global.get(\"Inicio\");\nvar to = global.get(\"Final\");\n\nmsg.topic = 'SELECT * FROM plc.trupal WHERE `Fecha` BETWEEN \"'+from+'\" AND \"'+to+'\";';\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 300,
        "y": 340,
        "wires": [
            [
                "fc79d95366bd9799"
            ]
        ]
    },
    {
        "id": "4ba0e4585c7a12ae",
        "type": "ui_template",
        "z": "619ad3d9eee698c2",
        "group": "4f96a77756f4ce93",
        "name": "",
        "order": 1,
        "width": "24",
        "height": "13",
        "format": "<style>\n #history {\n font-family: \"Arial\";\n border-collapse: collapse;\n width: 100%;\n }\n \n #history td, #history th {\n border: 1px solid #ddd;\n padding: 8px;\n }\n #history tr:nth-child(even){background-color: #A8EEF8;}\n \n #history tr:hover {background-color: #40aeea;}\n \n #history th {\n padding-top: 12px;\n padding-bottom: 12px;\n text-align: center;\n background-color: #696969;\n color: white;\n }\n \n \n </style>\n \n <table id=\"history\" border=\"1\">\n <tr align=\"center\">\n \n <th>id</th>\n <th>Fecha</th>\n <th>OEE_ME</th>\n <th>RECHAZO</th>\n <th>ENERGIAT1</th>\n <th>ENERGIA_T2</th>\n <th>ENERGIAT3</th>\n <th>ENERGIAPROMEDIO</th>\n <th>ENERGIA_TOTAL_T</th>\n <th>ENERGIAACTUAL</th>\n \n </tr>\n <tbody>\n <tr align=\"center\" ng-repeat=\"row in msg.payload\">\n <td ng-repeat=\"item in row\" >{{item}}</td>\n </tr>\n </tbody>\n </table>\n \n ",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 680,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "bd91d6d28d4a7275",
        "type": "ui_group",
        "name": "Produccion",
        "tab": "4e037359f216eb68",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "fb05e811b8b0da75",
        "type": "MySQLdatabase",
        "name": "",
        "host": "127.0.0.1",
        "port": "3306",
        "db": "plc",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "4f96a77756f4ce93",
        "type": "ui_group",
        "name": "Datos por Fecha",
        "tab": "4e037359f216eb68",
        "order": 3,
        "disp": true,
        "width": "24",
        "collapse": true,
        "className": ""
    },
    {
        "id": "4e037359f216eb68",
        "type": "ui_tab",
        "name": "Trupal",
        "icon": "dashboard",
        "order": 16,
        "disabled": false,
        "hidden": false
    }
]

```

 ![pdf](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/3/f3084fc66c8e4183217767d62130d73d4838b5ed.png)

---

<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:** [5 August 2022 22:21 UTC](https://discourse.nodered.org/t/pass-an-html-template-to-pdf-any-ideas/63536/2 "2022-08-05T22:21:52Z")

</div>

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