# Communicate with printer

**URL:** https://discourse.nodered.org/t/communicate-with-printer/10685
**Category:** General
**Created:** [30 April 2019 15:22 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685 "2019-04-30T15:22:38Z")
**Posts on this page:** 16
**Page:** 2

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [1 May 2019 08:53 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/22 "2019-05-01T08:53:43Z")

</div>

using GZPL am able to print. But now, i need to to send command via NR.  
Maybe i should try with ASCII commands  
it's completly fuzzy to me. I don't know from where i should begin ...

---

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [1 May 2019 08:55 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/23 "2019-05-01T08:55:12Z")

</div>

that's wha i'am planning to do. i should give a try with ascii commands ...  
Thanks a lot.

---

<div class="post-metadata">

### Author: ![Dan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Dan](https://discourse.nodered.org/u/Dan)
#### Post date: [1 May 2019 12:02 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/24 "2019-05-01T12:02:12Z")

</div>

> [@hathemi](#):
>
> it's completly fuzzy to me. I don't know from where i should begin ...

I can imagine that, but in the end you'll be the expert 😃

I would begin within node red, the printer nearby, attached with a serial cable. Try the examples on page 75ff in [EZPL\_EN\_J\_20180226.pdf](https://www.godexprinters.co.uk/downloads/manuals/desktop/EZPL_EN_J_20180226.pdf). If you are able to print what you want via serial, there will be a way to do it over ethernet as well.  
On top of page 12 in the [usemanual](https://www.godexprinters.co.uk/downloads/manuals/industrial/EZ2250i_user_manual_en.pdf) is a picture of the Printerdriver configuration. Try to connect the TCP/IP thing there (IP of printer), then send a textfile via Lpr command to the PC where the driver resides (IP of PC). The Textfile has probably to be something that worked localy via serial connection. Makes sense?

---

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [1 May 2019 12:52 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/25 "2019-05-01T12:52:01Z")

</div>

> [@Dan](#):
>
> I can imagine that, but in the end you'll be the expert

Thanks for the encouragement 😃 .. and for the docs. it helps a lot. i hope i can make a progress very soon.

> [@Dan](#):
>
> worked localy via serial connection

yeah you have raison. i connect my printer to Pc via usb cable

---

<div class="post-metadata">

### Author: ![Dan](https://avatars.discourse-cdn.com/v4/letter/d/eada6e/32.png) [@Dan](https://discourse.nodered.org/u/Dan)
#### Post date: [1 May 2019 16:30 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/26 "2019-05-01T16:30:37Z")

</div>

> [@hathemi](#):
>
> i connect my printer to Pc via usb cable

maybe it's better to connect via a RS232 serial cable as mentioned in the programming manual. The default settings to connect are:

 ![printer1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e89deb59bb705b86b47974aa9a8fb2ccc25c01d8.jpeg)  
If you have no cable at the moment, you may try it first with the NetSetting Software, it comes with the printer. Theres a function to send commands:  
 ![printer2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/076eac4f956c4cc2e0f440f4985af6e4a8756afd.jpeg)  
I assume that you can try out here some of the examples from page 75 of the programming manual. If they work here, try it via serial (RS232 not USB) cable, like mentioned in the programming manual p75:

> The label can be created by the following MS-DOS command:  
> C:\>COPY EX1.TXT PRN[RETURN]  
> To send the label to serial port by the following MS-DOS command:  
> C:\>MODE COM1 96,N,8,1  
> C:\>TYPE EX1.TXT \>\> COM1

At this point you may as well try out a serial output node in node red to send commands to the printer.

When printing via RS232 works and you figured out what command to send to fit your needs, the ethernet part will be the next thing to solve. But i'm pretty confident with that one 🙂

---

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [1 May 2019 19:15 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/27 "2019-05-01T19:15:09Z")

</div>

sorry my fault. i mean an ethernet cable not usb 😑  
I will follow your steps starting with RS232 ..  
thanks for help.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [1 May 2019 19:41 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/28 "2019-05-01T19:41:47Z")

</div>

Hi, no need to mess with serial ports. You can print on Windows by using PowerShell rather than the older command prompt. The PowerShell commandlet `Out-Printer` does the job.

You should also be able to output to your printer from the command prompt by redirecting output to a printer port:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/7561a1cdcb5ae72fc7c50eb9c91b7194435ed1d6.png)

Not tried it for years though so not sure if it still works. These seem to suggest that it does but you probably need to redirect LPT1: to your networked printer.

> **[How to Force the DOS Print Output to Go Through the Windows Spooler](https://smallbusiness.chron.com/force-dos-print-output-through-windows-spooler-49689.html)**
>
> While most businesses use Windows-based applications, some entrepreneurs still use legacy DOS-based programs that they find useful. Whether it's because the application is no longer being developed or the DOS program simply does what you need it to...

  

> **[How to print DOS output to printer](https://www.computerhope.com/issues/ch000199.htm)**
>
> Information on how to print the MS-DOS output to a computer printer.

---

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [2 May 2019 10:38 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/29 "2019-05-02T10:38:50Z")

</div>

i have installed godex driver and i have added it to lpt1  
i have tried to send command to printer like this

> file.txt lpr -S 192.x.x.x -P Godex EZ2250i  
> the result: it only open file.txt without printing.  
> So, is it a problem of the content of file.txt ???  
> here's what i send  
> ![Sans%20titre](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/72471bc06c95904ccdd59c6cc4009fa34e1126d7.png)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [2 May 2019 10:54 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/30 "2019-05-02T10:54:51Z")

</div>

You have the command the wrong way around.

> **[lpr](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/lpr)**
>
> Windows Commands topic for \*\*\*\* -

---

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [2 May 2019 11:01 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/31 "2019-05-02T11:01:31Z")

</div>

if you mean that filename should be at the end, the request wont be accept it. that's why i put it at the begining of the request

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [2 May 2019 13:09 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/32 "2019-05-02T13:09:23Z")

</div>

> [@hathemi](#):
>
> Godex EZ2250i

Is that the name of the printer? If so then you probably need to put it in quotes, with the filename on the end of course. As you have it it is interpreting EZ2250i as the filename.

---

<div class="post-metadata">

### Author: ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)
#### Post date: [2 May 2019 13:55 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/34 "2019-05-02T13:55:15Z")

</div>

> [@Colin](#):
>
> put it in quotes

no it's not a problrm of quotes.  
my printer is not ready to print. it has always state of "inactif" !! is it a problem of driver  
installation ?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [2 May 2019 15:31 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/35 "2019-05-02T15:31:08Z")

</div>

I don't understand. I thought you said earlier that you were able to print from other applications.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [2 May 2019 16:12 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/37 "2019-05-02T16:12:11Z")

</div>

So what is the situation now?

---

<div class="post-metadata">

### Author: ![grgdghjhahra](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@grgdghjhahra](https://discourse.nodered.org/u/grgdghjhahra)
#### Post date: [18 March 2022 10:55 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/43 "2022-03-18T10:55:22Z")

</div>

You can use CURL command for example from windows CMD or linux or any other system.  
egz.  
Sending ZPL label through Command line.

curl -d "^XA^CF0,60^FO50,50^GB100,100,100^FS^FO75,75^FR^GB100,100,100^FS^FO93,93^GB40,40,40^FS^FO220,50^FDIntershipping, Inc.^FS^CF0,30^FO220,115^FD1000 Shipping Lane^FS^FO220,155^FDShelbyville TN 38102^FS^FO220,195^FDUnited States (USA)^FS^FO50,250^GB700,3,3^FS^FX Second section with recipient address and permit information.^CFA,30^FO50,300^FDJohn Doe^FS^FO50,340^FD100 Main Street^FS^FO50,380^FDSpringfield TN 39021^FS^FO50,420^FDUnited States (USA)^FS^CFA,15^FO600,300^GB150,150,3^FS^FO638,340^FDPermit^FS^FO638,390^FD123456^FS^FO50,500^GB700,3,3^FS^FX Third section with bar code.^BY5,2,100^FO100,550^BC^FD12345678^FS^FX Fourth section (the two boxes on the ottom).^FO50,700^GB700,200,3^FS^FO400,700^GB3,200,3^FS^CF0,40^FO100,730^FDCtr. X34B-1^FS^FO100,770^FDREF1 F00B47^FS^FO100,810^FDREF2 BL4H8^FS^CF0,190^FO470,725^FDCA^FS^XZ" [http://192.168.0.66:9100](http://192.168.0.66:9100)

wheres 192.168.0.66 is Your printer IP,  
and 9100- is listening port of your printer

its work even with Chrome "ZPL Printer" (virtual printer add.)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [18 March 2022 13:55 UTC](https://discourse.nodered.org/t/communicate-with-printer/10685/44 "2022-03-18T13:55:29Z")

</div>



[Previous page](https://discourse.nodered.org/t/communicate-with-printer/10685.md?page=1)
