escp


Nameescp JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/yackx/python-escp
SummaryA library to drive ESC/P printers
upload_time2023-06-22 17:42:34
maintainer
docs_urlNone
authorYouri Ackx
requires_python>=3.11
licenseGPL
keywords esc/p printers printing dot matrix
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # escp

**A Python library to drive ESC/P printers**

## Motivation

There is **no driver** available for your printer, or there is one but it is **slow** and the **print quality is mediocre**.

Missing driver can be worked around by using a generic 9-pin or 24-pin generic driver. To get the highest quality, this library focuses on **text mode** printing, leveraging device fonts (built-in fonts), as opposed to modern drivers that rely on graphics.

![Printing sample on a 9-pin Epson LX-300+II](escp.jpg)

## Installation

```bash
pip install escp
```

## Use

Only USB is supported for now. You can find the `id_vendor` and `id_product` values using `lsusb`.

```bash
$ lsusb | grep -i epson
Bus 001 Device 004: ID 04b8:0005 Seiko Epson Corp. Printer
```

```python
import escp

# Create a printer instance (Espon LX-300+II)
printer = escp.UsbPrinter(id_vendor=0x04b8, id_product=0x0005)
# Obtain commands for 9-pin printer
commands = escp.lookup_by_pins(9)
# Prepare the buffer to print a short text
commands.init().text('ESC/P direct printing test page').cr_lf(2)
# Printer go brrrrrr
printer.send(commands.buffer)
```

See  [demo](src/escp/demo.py) for a more complete example.

## Features

### ESC/P, ESC/P2, ESC/POS

| Variant | Supported |
|---------|-----------|
| ESC/P   | ✓         |
| ESC/P2  | ✗         |
| ESC/POS | ✗         |

- **ESC/P** (Epson Standard Code for Printers), sometimes called *Escape/P*, is a printer control language developed by Epson to control computer printers. It was mainly used in dot matrix printers and some inkjet printers, and is still widely used in many receipt thermal printers. Supported. Primary target.
- **ESC/P2** is a more recent variant of ESC/P by Epson. Backward compatible with ESC/P. Not supported. Switch to ESC/P but some features won't be available.
- **ESC/POS** is a variant for controlling receipt printers as commonly used at the point of sale (POS). Often thermal printers. Not supported and out of scope. Use the comprehensive [python-escpos](https://github.com/python-escpos/python-escpos) library instead.

References

- [Epson reference manual (dec. 1997)](https://files.support.epson.com/pdf/general/escp2ref.pdf)
- [Wikipedia](https://en.wikipedia.org/wiki/ESC/P)

### Printers

Tested on a 9-pin reference printer: **Epson LX-300+II**. All 9-pin printers should work, with minor hardware limitations on some commands. 24/48-pin printers are implemented bt not tested. The differences between 9-pin and 24/48 pin are minor.

| Type       | Status                                    |
|------------|-------------------------------------------|
| 9-pin      | Work in progress – Text mode              |
| 24/48-pin  | Work in progress – Text mode – Not tested |

### Connectivity

| Connector | Status |
|-----------|------- |
| USB       | ✓      |
| Serial    | ✗      |
| Parallel  | ✗      |
| File      | ✓      |

Although serial and parallel ports are not supported, you can output the printer commands to a file and send it in raw mode to the printer using `lpr`.

## Credits

Inspired from [python-escpos](https://github.com/python-escpos/python-escpos).

## License

[GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.txt)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yackx/python-escp",
    "name": "escp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "ESC/P,printers,printing,dot matrix",
    "author": "Youri Ackx",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/2a/21/42b8136e009ae907a7bc1a0bc278e55412719dd17c7eb6fbd9c627c3ed3b/escp-0.0.6.tar.gz",
    "platform": null,
    "description": "# escp\n\n**A Python library to drive ESC/P printers**\n\n## Motivation\n\nThere is **no driver** available for your printer, or there is one but it is **slow** and the **print quality is mediocre**.\n\nMissing driver can be worked around by using a generic 9-pin or 24-pin generic driver. To get the highest quality, this library focuses on **text mode** printing, leveraging device fonts (built-in fonts), as opposed to modern drivers that rely on graphics.\n\n![Printing sample on a 9-pin Epson LX-300+II](escp.jpg)\n\n## Installation\n\n```bash\npip install escp\n```\n\n## Use\n\nOnly USB is supported for now. You can find the `id_vendor` and `id_product` values using `lsusb`.\n\n```bash\n$ lsusb | grep -i epson\nBus 001 Device 004: ID 04b8:0005 Seiko Epson Corp. Printer\n```\n\n```python\nimport escp\n\n# Create a printer instance (Espon LX-300+II)\nprinter = escp.UsbPrinter(id_vendor=0x04b8, id_product=0x0005)\n# Obtain commands for 9-pin printer\ncommands = escp.lookup_by_pins(9)\n# Prepare the buffer to print a short text\ncommands.init().text('ESC/P direct printing test page').cr_lf(2)\n# Printer go brrrrrr\nprinter.send(commands.buffer)\n```\n\nSee  [demo](src/escp/demo.py) for a more complete example.\n\n## Features\n\n### ESC/P, ESC/P2, ESC/POS\n\n| Variant | Supported |\n|---------|-----------|\n| ESC/P   | \u2713         |\n| ESC/P2  | \u2717         |\n| ESC/POS | \u2717         |\n\n- **ESC/P** (Epson Standard Code for Printers), sometimes called *Escape/P*, is a printer control language developed by Epson to control computer printers. It was mainly used in dot matrix printers and some inkjet printers, and is still widely used in many receipt thermal printers. Supported. Primary target.\n- **ESC/P2** is a more recent variant of ESC/P by Epson. Backward compatible with ESC/P. Not supported. Switch to ESC/P but some features won't be available.\n- **ESC/POS** is a variant for controlling receipt printers as commonly used at the point of sale (POS). Often thermal printers. Not supported and out of scope. Use the comprehensive [python-escpos](https://github.com/python-escpos/python-escpos) library instead.\n\nReferences\n\n- [Epson reference manual (dec. 1997)](https://files.support.epson.com/pdf/general/escp2ref.pdf)\n- [Wikipedia](https://en.wikipedia.org/wiki/ESC/P)\n\n### Printers\n\nTested on a 9-pin reference printer: **Epson LX-300+II**. All 9-pin printers should work, with minor hardware limitations on some commands. 24/48-pin printers are implemented bt not tested. The differences between 9-pin and 24/48 pin are minor.\n\n| Type       | Status                                    |\n|------------|-------------------------------------------|\n| 9-pin      | Work in progress \u2013 Text mode              |\n| 24/48-pin  | Work in progress \u2013 Text mode \u2013 Not tested |\n\n### Connectivity\n\n| Connector | Status |\n|-----------|------- |\n| USB       | \u2713      |\n| Serial    | \u2717      |\n| Parallel  | \u2717      |\n| File      | \u2713      |\n\nAlthough serial and parallel ports are not supported, you can output the printer commands to a file and send it in raw mode to the printer using `lpr`.\n\n## Credits\n\nInspired from [python-escpos](https://github.com/python-escpos/python-escpos).\n\n## License\n\n[GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.txt)\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "A library to drive ESC/P printers",
    "version": "0.0.6",
    "project_urls": {
        "Bug Tracker": "https://github.com/yackx/python-escp/issues",
        "Documentation": "https://github.com/yackx/python-escp/blob/master/README.md",
        "Homepage": "https://github.com/yackx/python-escp",
        "Release Notes": "https://github.com/yackx/python-escp/releases"
    },
    "split_keywords": [
        "esc/p",
        "printers",
        "printing",
        "dot matrix"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c49c12d4a44e6d68c5e6bbc2c266d5798fd579f2c9477a045cfa1df9c05d4acd",
                "md5": "886be947411b506100da72cf12086fc1",
                "sha256": "6d61b6e9933405cf06bf28b4b7f3eda36deb368c265b20d9f81a94cefc98357e"
            },
            "downloads": -1,
            "filename": "escp-0.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "886be947411b506100da72cf12086fc1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 31907,
            "upload_time": "2023-06-22T17:42:29",
            "upload_time_iso_8601": "2023-06-22T17:42:29.294521Z",
            "url": "https://files.pythonhosted.org/packages/c4/9c/12d4a44e6d68c5e6bbc2c266d5798fd579f2c9477a045cfa1df9c05d4acd/escp-0.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a2142b8136e009ae907a7bc1a0bc278e55412719dd17c7eb6fbd9c627c3ed3b",
                "md5": "26f1ab985f4beaa0e7d70b4a94ea3e36",
                "sha256": "a5a1bd4bd2e834287fc9718409b78635cf1bd53a6bfccef084f7b57fcff8b007"
            },
            "downloads": -1,
            "filename": "escp-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "26f1ab985f4beaa0e7d70b4a94ea3e36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 985219,
            "upload_time": "2023-06-22T17:42:34",
            "upload_time_iso_8601": "2023-06-22T17:42:34.925219Z",
            "url": "https://files.pythonhosted.org/packages/2a/21/42b8136e009ae907a7bc1a0bc278e55412719dd17c7eb6fbd9c627c3ed3b/escp-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-22 17:42:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yackx",
    "github_project": "python-escp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "escp"
}
        
Elapsed time: 0.07894s