# Thermal inkjet printer with node red

**URL:** <https://discourse.nodered.org/t/thermal-inkjet-printer-with-node-red/82725>\
**Category:** Industrial\
**Tags:** http-request\
**Created:** [8 November 2023 22:53 UTC](https://discourse.nodered.org/t/thermal-inkjet-printer-with-node-red/82725 "2023-11-08T22:53:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danhoo1](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@danhoo1](https://discourse.nodered.org/u/danhoo1)\
**Post date:** [8 November 2023 22:53 UTC](https://discourse.nodered.org/t/thermal-inkjet-printer-with-node-red/82725/1 "2023-11-08T22:53:02Z")

</div>

Hello y'all. I have a HX Nitro Printer that accepts dynamic text over wifi and im wondering if someone could give me a bit of a head start on how i would setup a flow that would change the text of what the printer is printing from node red. see attached for the manual they sent me on the commands. Im a bit new to this lol

[hx\_autopilot\_user\_manual.pdf](https://discourse.nodered.org/uploads/short-url/pdqTiXuMQ1eZ5w9CphQZjFOrvMG.pdf) (559.4 KB)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [9 November 2023 09:29 UTC](https://discourse.nodered.org/t/thermal-inkjet-printer-with-node-red/82725/2 "2023-11-09T09:29:32Z")

</div>

Hi @danhoo1

According to the manual, it accepts HTTP POST commands, and the data being sent needs to be XML.  
Naturally this will be guess work, but according to the manual, something like this, is what you are looking for.

```auto
<Cookie>
	<Auth_token_1109>{Password}</Auth_token_1109>
</Cookie>
<APCMD>
	<CTEXT>
	    <POS>20,10</POS>
	    <TXT>ABC Company</TXT>
	</CTEXT>
</APCMD>

```

Where `{Password}` is your MD5 hashed password, converted to a Base64 string.

Using the `HTTP Request` Node, will be the node to use here, and the `Template` Node.  
The below will get you started, but you may need to seek support from the manufacturer, if something isn't right - as said, this is just a guess.

You will need to set the URL in the Request Node - and connect it to the `Template` Node of course (which creates the XML body)

```auto
[{"id":"a37d6496c9d8e6b9","type":"inject","z":"9c654e1a5e55d43d","name":"Set Auth, Pos, & Text","props":[{"p":"auth","v":"Password1","vt":"str"},{"p":"pos","v":"10,10","vt":"str"},{"p":"text","v":"Hello, World","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":520,"y":640,"wires":[["0f495bfc45920740"]]},{"id":"408370e5f6ec9633","type":"template","z":"9c654e1a5e55d43d","name":"XML Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<Cookie>\n\t<Auth_token_1109>{{{auth}}}</Auth_token_1109>\n</Cookie>\n<APCMD>\n\t<CTEXT>\n\t <POS>{{pos}}</POS>\n\t <TXT>{{text}}</TXT>\n\t</CTEXT>\n</APCMD>","output":"str","x":820,"y":720,"wires":[["f7e48a7a884873c1"]]},{"id":"f7e48a7a884873c1","type":"debug","z":"9c654e1a5e55d43d","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":640,"wires":[]},{"id":"09d792c316b80c0b","type":"http request","z":"9c654e1a5e55d43d","name":"Send to printer via HTTP","method":"POST","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"other","valueValue":"application/xml"}],"credentials":{},"x":1090,"y":720,"wires":[[]]},{"id":"0f495bfc45920740","type":"function","z":"9c654e1a5e55d43d","name":"MD5 Hash -> Base64 the password","func":"msg.auth = crypto.createHash('md5').update(msg.auth).digest(\"hex\")\nmsg.auth = Buffer.from(msg.auth).toString('base64')\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"crypto","module":"crypto"}],"x":560,"y":720,"wires":[["408370e5f6ec9633"]]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0dd971bf445a932186028b84bf7580a09a69a53a.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:** [8 January 2024 09:30 UTC](https://discourse.nodered.org/t/thermal-inkjet-printer-with-node-red/82725/3 "2024-01-08T09:30:06Z")

</div>

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