A modern TypeScript library for printing to DYMO label printers.
The original library has no TypeScript support and lacks proper error handling for many of its functions. Furthermore, it uses callbacks instead of async/await and is really heavy.
- DYMO Web Service must be installed and running on the client machine
- Compatible DYMO printer connected to the system
- Modern browser with JavaScript enabled
# Deno
deno add jsr:@ctrlhaltdefeat/modern-dymo-print
# Node.js with npm
npx jsr add @ctrlhaltdefeat/modern-dymo-print
# Node.js with yarn
yarn add jsr:@ctrlhaltdefeat/modern-dymo-print
# Node.js with pnpm
pnpm i jsr:@ctrlhaltdefeat/modern-dymo-print
- Modern TypeScript implementation
- Full type safety and IntelliSense support
- No external dependencies
- Simple API for printing
- Use either an already parsed XMLDocument or strings as labels
DymoPrintService
has a static method initDymoPrintService
that searches for
a running DYMO WebService with the following parameters:
Parameter | Values |
---|---|
Host | localhost, 127.0.0.1 |
Port | 41951:41960 |
import { DymoPrinter, DymoPrintService } from "@ctrlhaltdefeat/dymo-print";
// Init the print service
const printService = await DymoPrintService.initDymoPrintService();
// Get available printers
const printers: DymoPrinter[] = await printService.getPrinters();
// Print to the first available printer
if (printers.length > 0) {
await printService.printLabel(printers[0], "YOUR LABEL HERE");
}
import { DymoPrinter, DymoPrintService } from "@ctrlhaltdefeat/dymo-print";
// Init the print service
const printService = await DymoPrintService.initDymoPrintService();
// Get all available DYMO printers
const printers: DymoPrinter[] = await printService.getPrinters();
printers.foreach((printer) => {
console.log(printer.isLocal);
console.log(printer.isConnected);
console.log(printer.modelName);
console.log(printer.name);
console.log(printer.printerType);
});
Contributions are welcome! Please feel free to submit a Pull Request.
MIT