{"id":21058189,"url":"https://github.com/bebo925/ng-thermal-print","last_synced_at":"2025-04-28T13:32:20.900Z","repository":{"id":34674700,"uuid":"182322285","full_name":"bebo925/ng-thermal-print","owner":"bebo925","description":"Angular module for connecting and printing to thermal printers.","archived":false,"fork":false,"pushed_at":"2024-01-04T00:14:06.000Z","size":2393,"stargazers_count":44,"open_issues_count":65,"forks_count":44,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-20T17:40:55.629Z","etag":null,"topics":["angular","thermal-printer"],"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/bebo925.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}},"created_at":"2019-04-19T20:32:35.000Z","updated_at":"2024-12-10T19:50:41.000Z","dependencies_parsed_at":"2024-06-19T17:35:40.808Z","dependency_job_id":"7ef170d3-e7ef-4caa-a0dd-febbac92e571","html_url":"https://github.com/bebo925/ng-thermal-print","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bebo925%2Fng-thermal-print","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bebo925%2Fng-thermal-print/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bebo925%2Fng-thermal-print/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bebo925%2Fng-thermal-print/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bebo925","download_url":"https://codeload.github.com/bebo925/ng-thermal-print/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251319757,"owners_count":21570451,"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","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":["angular","thermal-printer"],"created_at":"2024-11-19T17:06:42.141Z","updated_at":"2025-04-28T13:32:20.684Z","avatar_url":"https://github.com/bebo925.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Angular Thermal Printer Library\n\nA library for connecting Angular apps with thermal printers.\n\n## Drivers\n\n1. WEBUSB API (No drivers needed. Only works with Chrome and Opera with USB connection)\n\n2. WebPRNT (http)\n\n## Print Language Drivers\n\n1. ESC/POS\n\n2. StarPRNT\n\n3. Star WebPRNT\n\n## Installation\n\nInstall library\n\n`npm install ng-thermal-print`\n\nNOTE: if when compiling project you get an error like this:\n`ERROR in node_modules/ng-thermal-print/lib/drivers/UsbDriver.d.ts:16:30 - error TS2304: Cannot find name 'USBDevice'. requestUsb(): Observable;`\nthen add reference to w3c-web-usb by installing it with command: `npm install @types/w3c-web-usb --only=dev`\n\nImport into your application\n\n    import { BrowserModule } from '@angular/platform-browser';\n    import { NgModule } from '@angular/core';\n    import { ThermalPrintModule } from 'ng-thermal-print'; //add this line\n    import { AppComponent } from './app.component';\n\n    @NgModule({\n       declarations: [\n            AppComponent\n        ],\n        imports: [\n            BrowserModule,\n            ThermalPrintModule //add this line\n        ],\n        providers: [],\n        bootstrap: [AppComponent]\n    })\n    export class AppModule { }\n\n## Example Usage\n\napp.component.ts\n\n    import { PrintService, UsbDriver, WebPrintDriver } from 'ng-thermal-print';\n    import { Component } from '@angular/core';\n    import { PrintDriver } from 'ng-thermal-print/lib/drivers/PrintDriver';\n\n    @Component({\n        selector: 'app-root',\n        templateUrl: './app.component.html',\n        styleUrls: ['./app.component.css']\n    })\n    export class AppComponent {\n        status: boolean = false;\n        usbPrintDriver: UsbDriver;\n        webPrintDriver: WebPrintDriver;\n        ip: string = '';\n\n        constructor(private printService: PrintService) {\n            this.usbPrintDriver = new UsbDriver();\n            this.printService.isConnected.subscribe(result =\u003e {\n                this.status = result;\n                if (result) {\n                    console.log('Connected to printer!!!');\n                } else {\n                console.log('Not connected to printer.');\n                }\n            });\n        }\n\n        requestUsb() {\n            this.usbPrintDriver.requestUsb().subscribe(result =\u003e {\n                this.printService.setDriver(this.usbPrintDriver, 'ESC/POS');\n            });\n        }\n\n        connectToWebPrint() {\n            this.webPrintDriver = new WebPrintDriver(this.ip);\n            this.printService.setDriver(this.webPrintDriver, 'WebPRNT');\n        }\n\n        print(driver: PrintDriver) {\n            this.printService.init()\n                .setBold(true)\n                .writeLine('Hello World!')\n                .setBold(false)\n                .feed(4)\n                .cut('full')\n                .flush();\n        }\n    }\n\napp.component.html\n\n    \u003cstrong\u003eStatus: {{status}}\u003c/strong\u003e\n    \u003cdiv\u003e\n        \u003cinput [(ngModel)]=\"ip\" type=\"text\" name=\"ip\" placeholder=\"IP of printer with WebPRNT\"\u003e\n        \u003cbutton (click)=\"connectToWebPrint()\"\u003eConnect to WebPRNT\u003c/button\u003e\n    \u003c/div\u003e\n\n    \u003cdiv\u003e\n        \u003cbutton (click)=\"requestUsb()\"\u003eConnect to USB\u003c/button\u003e\n    \u003c/div\u003e\n\n    \u003cdiv\u003e\n        \u003cbutton (click)=\"print()\" [disabled]=\"status === false\"\u003e Print!\u003c/button\u003e\n    \u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbebo925%2Fng-thermal-print","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbebo925%2Fng-thermal-print","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbebo925%2Fng-thermal-print/lists"}