# Printing Libraries

Every ESC/POS library has a network transport, and pointing it here is a one-line change: the host and
port of your virtual printer instead of the device on your network.

The examples below all print the same thing; substitute your own port.

## python-escpos

```python
from escpos.printer import Network

printer = Network("virtual-printer.online", port=9411)
printer.text("Hello from python-escpos\n")
printer.cut()
printer.close()
```

`Network` is the transport to use - not `Usb`, not `Serial`, and not `File`.

## node-thermal-printer

```javascript
const { ThermalPrinter, PrinterTypes } = require('node-thermal-printer');

const printer = new ThermalPrinter({
  type: PrinterTypes.EPSON,
  interface: 'tcp://virtual-printer.online:9411',
});

printer.println('Hello from node-thermal-printer');
printer.cut();
await printer.execute();
```

## escpos-php

```php
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
use Mike42\Escpos\Printer;

$connector = new NetworkPrintConnector("virtual-printer.online", 9411);
$printer = new Printer($connector);
$printer->text("Hello from escpos-php\n");
$printer->cut();
$printer->close();
```

## ESCPOS.NET

```csharp
var printer = new ESCPOS_NET.NetworkPrinter(
    new NetworkPrinterSettings
    {
        ConnectionString = "virtual-printer.online:9411"
    });

var e = new ESCPOS_NET.Emitters.EPSON();
printer.Write(e.PrintLine("Hello from ESCPOS.NET"), e.FullCut());
```

## If nothing arrives

Libraries differ in when they flush and whether they close the connection. A document is finalized when
the socket closes or after a short idle timeout, so a library that keeps the connection open produces
nothing until it does - call its close or execute method. See
[Nothing appears](/docs/troubleshooting/nothing-appears).

## Writing the bytes yourself

No library is required: see [Code samples](/docs/setup/code-samples) for a plain socket in C#, C++,
Node.js and Python.
