{"id":29649705,"url":"https://github.com/andorthehood/epson-tm-u220-driver-node","last_synced_at":"2025-07-22T04:07:54.433Z","repository":{"id":297695985,"uuid":"997591522","full_name":"andorthehood/epson-tm-u220-driver-node","owner":"andorthehood","description":"Small node.js util to send commands to Epson TM-U222*","archived":false,"fork":false,"pushed_at":"2025-06-08T21:21:04.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-17T06:49:57.373Z","etag":null,"topics":["epson","escpos","tm-u22","tm-u22iid"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andorthehood.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-06T19:43:42.000Z","updated_at":"2025-06-08T21:21:07.000Z","dependencies_parsed_at":"2025-06-28T17:15:58.992Z","dependency_job_id":null,"html_url":"https://github.com/andorthehood/epson-tm-u220-driver-node","commit_stats":null,"previous_names":["andormade/epson-tm-u220iid-driver","andormade/epson-tm-u220-driver-node","andorthehood/epson-tm-u220-driver-node"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andorthehood/epson-tm-u220-driver-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorthehood%2Fepson-tm-u220-driver-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorthehood%2Fepson-tm-u220-driver-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorthehood%2Fepson-tm-u220-driver-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorthehood%2Fepson-tm-u220-driver-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andorthehood","download_url":"https://codeload.github.com/andorthehood/epson-tm-u220-driver-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andorthehood%2Fepson-tm-u220-driver-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266424194,"owners_count":23926131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["epson","escpos","tm-u22","tm-u22iid"],"created_at":"2025-07-22T04:07:53.945Z","updated_at":"2025-07-22T04:07:54.425Z","avatar_url":"https://github.com/andorthehood.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Epson TM-U220* Printer Driver\n\nA TypeScript driver for the Epson TM-U220* receipt printers. Since it uses standard ESC/POS commands, it may work with other compatible printers as well. I only tested it with the TM-U220IID model.\n\nFor general ESC/POS printer usage, I recommend using the [escpos](https://www.npmjs.com/package/escpos) package. This driver is intended for cases where you need a minimal, specialized solution specifically for TM-U220* series printers.\n\nThe TM-U22* series are impact (dot matrix) printers, which have more limited capabilities compared to thermal receipt printers. Features such as graphics, barcode printing, and advanced formatting are not available.\n\n## Installation\n\n```bash\nnpm install epson-tm-u220-driver\n```\n\n## Usage\n\n### Basic Example\n\n```typescript\nimport PrinterBuffer, { Alignment, TextSize } from 'epson-tm-u220iid-driver';\n\nconst printer = new PrinterBuffer({\n    portPath: '/dev/tty.usbserial',  // Your serial port path\n    baudRate: 9600,                  // Optional, defaults to 9600\n    autoOpen: true                   // Optional, defaults to true\n});\n\n// Simple print job\nawait printer\n    .init()\n    .text('Hello World!')\n    .print();\n\n// Formatted print job\nawait printer\n    .init()\n    .align(Alignment.CENTER)\n    .size(TextSize.DOUBLE_HEIGHT)\n    .text('Double height')\n    .init()\n    .text('Regular text')\n    .feed(3)\n    .print();\n\nawait printer.close(); // Close the port when done\n```\n\n### Usage notes\n\nThis library does not automatically insert line breaks in your text. The printer itself wraps or breaks lines based on its character width (typically 42 or 48 characters per line, depending on the model and font size), and does not respect whitespace or word boundaries. If you need control over line breaks or word wrapping, manually insert `\\n` where needed in your text.\n\nBecause the character set of these printers is quite limited, I recommend using a library like [transliteration](https://www.npmjs.com/package/transliteration) to convert Unicode characters to their closest ASCII equivalents before printing.\n\n### Text Formatting\n\nThe driver supports various text formatting options:\n\n```typescript\n// Alignment\nprinter.align(Alignment.LEFT);\nprinter.align(Alignment.CENTER);\nprinter.align(Alignment.RIGHT);\n\n// Text Size\nprinter.size(TextSize.NORMAL);\nprinter.size(TextSize.DOUBLE_HEIGHT);\nprinter.size(TextSize.DOUBLE_WIDTH);\nprinter.size(TextSize.DOUBLE_BOTH);\n```\n\n## API Reference\n\n### Constructor Options\n\n```typescript\ninterface PrinterOptions {\n    portPath: string;    // Path to the serial port\n    baudRate?: number;   // Baud rate (default: 9600)\n    autoOpen?: boolean;  // Auto-open port (default: true)\n}\n```\n\n### Methods\n\n- `init()`: Initialize the printer\n- `text(text: string)`: Add text to the buffer\n- `align(alignment: Alignment)`: Set text alignment\n- `size(size: TextSize)`: Set text size\n- `feed(lines: number = 2)`: Feed paper lines\n- `clear()`: Clear the print buffer\n- `print()`: Print the buffer contents\n- `close()`: Close the serial port\n\n### Enums\n\n```typescript\nenum Alignment {\n    LEFT = '\\x1B\\x61\\x00',\n    CENTER = '\\x1B\\x61\\x01',\n    RIGHT = '\\x1B\\x61\\x02'\n}\n\nenum TextSize {\n    NORMAL = '\\x1B\\x21\\x00',\n    DOUBLE_HEIGHT = '\\x1B\\x21\\x10',\n    DOUBLE_WIDTH = '\\x1B\\x21\\x20',\n    DOUBLE_BOTH = '\\x1B\\x21\\x30'\n}\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Run tests\nnpm test\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandorthehood%2Fepson-tm-u220-driver-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandorthehood%2Fepson-tm-u220-driver-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandorthehood%2Fepson-tm-u220-driver-node/lists"}