@dynamicsmobile/sdk-print
v2.7.0
Published
Print library for Dynamics Mobile
Maintainers
Readme
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
npm install dynamicsmobile-printBasic Usage
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 formatTemplates
The library supports Handlebars templates for creating receipts. Example:
{{#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)
Bug Fixes
- usbakeryimpl-220 issue with label height (e968378)
2.6.0 (2025-11-18)
Features
- usbakeryimpl-220 create batch printing (02d1642)
2.5.0 (2025-11-18)
Features
- usbakeryimpl-220 create batch printing (02d1642)
2.3.7 (2025-10-29)
2.3.32 (2025-11-17)
2.3.31 (2025-11-13)
2.3.30 (2025-11-13)
2.3.29 (2025-11-13)
2.3.28 (2025-11-13)
2.3.27 (2025-11-13)
2.3.26 (2025-11-13)
2.3.25 (2025-11-13)
2.3.24 (2025-11-13)
2.3.23 (2025-10-31)
2.3.21 (2025-10-30)
2.3.19 (2025-10-29)
2.3.18 (2025-10-29)
2.3.17 (2025-10-29)
2.3.16 (2025-10-29)
2.3.15 (2025-10-29)
2.3.14 (2025-10-29)
2.3.13 (2025-10-29)
2.3.12 (2025-10-29)
2.3.11 (2025-10-29)
2.3.10 (2025-10-29)
2.3.9 (2025-10-29)
2.3.8 (2025-10-29)
2.3.7 (2025-10-29)
2.3.6 (2025-10-29)
2.3.5 (2025-10-29)
2.3.4 (2025-10-29)
2.3.3 (2025-10-29)
2.3.2 (2025-09-25)
Bug Fixes
- dietwatsup-112 printLine was not using alignmetn (eff8679)
- dietwatsup-112 restore previous printImage logic (d2d4a5c)
2.3.1 (2025-09-25)
2.3.0 (2025-09-25)
Features
- dietwatsup-112 added support for imageRow in zpl (bdb7146)
2.2.1 (2025-09-17)
2.2.0 (2025-09-17)
Features
- spr-44 new logic for handling barcodes and text styles (de51285)
