Guides • Website • Contact • Login •
dynamicsmobile-print
A comprehensive library for generating and printing receipts using various printer languages.
Overview
The dynamicsmobile-print library provides functionality for generating printable output in multiple printer languages including ZPL (Zebra), CPCL, ESC/P2, HTML, and plain text. It enables seamless integration with various printer types for receipt generation in mobile and desktop applications.
Features
Multi-language Support:
ZebraZPL (for Zebra printers)
BrotherZPL (for Brother printers with ZPL support)
CPCL (beta support for CPCL compatible printers)
Text (plain text output)
HTML (for web display or native printing)
ESC/P2 (for Epson and compatible printers)
Flexible Receipt Generation:
Template-based generation using Handlebars
Direct programmatic generation
Rich Content Support:
Text formatting with multiple styles
Image printing capabilities
QR codes and barcodes
Tables and structured layouts
Horizontal rulers and dividers
Customization Options:
Page width configuration
Font size and style options
Text alignment and formatting
Installation
``
bash
npm install dynamicsmobile-print
`
Basic Usage
`
typescript
import {
PrinterLanguageFactory,
PrinterTypes,
ReceiptTemplateGenerator
} from 'dynamicsmobile-print';
// Create a printer language instance
const printerLanguage = PrinterLanguageFactory.getPrinterLanguage(PrinterTypes.ZebraZPL);
const receiptTemplate = '....';
// Configure the printer (optional)
printerLanguage.init({ width: 70 });
// Generate content using templates
const templateGenerator = new ReceiptTemplateGenerator();
const receipt = await templateGenerator.generate(
{templateType: 'receipt',userName:'someone',template:receiptTemplate,settings:{},translations:{},model:{},printerLanguage: new HtmlPrinterLanguage(),appVersion:'1.0',config:{width:40,currency:'EUR',ruler:'-'} }
);
/
// Get the final output
console.log(receipt); // in html format
`
Templates
The library supports Handlebars templates for creating receipts.
Example:
`
html
{{#title}}SALES RECEIPT{{/title}}
{{#bold}}Store: {{storeName}}{{/bold}}
{{#normal}}Date: {{date}}{{/normal}}
{{#ruler}}-{{/ruler}}
{{#items}}
{{#normal}}{{name}} x{{quantity}}{{/normal}}
{{#alignRight}}${{price}}{{/alignRight}}
{{/items}}
{{#ruler}}={{/ruler}}
{{#bold}}TOTAL: ${{total}}{{/bold}}
{{#qrcode}}{{receiptUrl}}{{/qrcode}}
``
Supported Printer Types
The library provides implementations for these printer types:
Html - HTML output for web display
Text - Plain text output
ZebraZPL - Zebra ZPL language
BrotherZPL - Brother printers with ZPL support
CPCL - CPCL language (beta)
EscP2 - ESC/P2 language
Documentation
For detailed API documentation and examples, refer to the source code and included examples.
License
Proprietary - All rights reserved by Dynamics Mobile
📦 Changelog
2.6.1 (2025-11-19)
$3
* usbakeryimpl-220 issue with label height (
e968378)
2.6.0 (2025-11-18)
$3
* usbakeryimpl-220 create batch printing (
02d1642)
2.5.0 (2025-11-18)
$3
* usbakeryimpl-220 create batch printing (
02d1642)
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
$3
* dietwatsup-112 printLine was not using alignmetn (
eff8679)
* dietwatsup-112 restore previous printImage logic (
d2d4a5c)
$3
2.3.0 (2025-09-25)
$3
* dietwatsup-112 added support for imageRow in zpl (
bdb7146)
$3
2.2.0 (2025-09-17)
$3
* spr-44 new logic for handling barcodes and text styles (
de51285)