label-printer 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -110,7 +110,7 @@ interface CommandGenerator<T extends Command> {
|
|
|
110
110
|
/**
|
|
111
111
|
* This should generate the needed commands to set up a label before printing
|
|
112
112
|
*/
|
|
113
|
-
setUp: (width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean, unitSystem: UnitSystem) => T;
|
|
113
|
+
setUp: (width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean, unitSystem: UnitSystem, density: number) => T;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -397,6 +397,16 @@ declare class TSPLDiagonal extends TSPLCommand {
|
|
|
397
397
|
get commandString(): string;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Clear the image buffer
|
|
402
|
+
* {@link /documentsions/TSPL.pdf}
|
|
403
|
+
*/
|
|
404
|
+
declare class TSPLDensityCommand extends TSPLCommand {
|
|
405
|
+
private density;
|
|
406
|
+
constructor(density: number);
|
|
407
|
+
get commandString(): string;
|
|
408
|
+
}
|
|
409
|
+
|
|
400
410
|
/**
|
|
401
411
|
* Command generator for tspl commands
|
|
402
412
|
*/
|
|
@@ -405,7 +415,7 @@ declare class TSPLCommandGenerator implements CommandGenerator<TSPLCommand> {
|
|
|
405
415
|
print(sets: number, copiesPerSet: number): TSPLCommand;
|
|
406
416
|
text(content: string, x: number, y: number, font: string | "default", size: number): TSPLCommand;
|
|
407
417
|
upload(name: string, data: ArrayBuffer | Uint8Array): TSPLCommand;
|
|
408
|
-
setUp(width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean | undefined, unitSystem: UnitSystem): TSPLCommand;
|
|
418
|
+
setUp(width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean | undefined, unitSystem: UnitSystem, density: number): TSPLCommand;
|
|
409
419
|
display(): TSPLCommandGroup;
|
|
410
420
|
line(start: Point, end: Point, thickness: number): TSPLCommand;
|
|
411
421
|
image(image: BitmapLike, x: number, y: number, mode?: GraphicMode | undefined): TSPLCommand;
|
|
@@ -436,6 +446,8 @@ type index$3_TSPLCommand = TSPLCommand;
|
|
|
436
446
|
declare const index$3_TSPLCommand: typeof TSPLCommand;
|
|
437
447
|
type index$3_TSPLCommandGroup = TSPLCommandGroup;
|
|
438
448
|
declare const index$3_TSPLCommandGroup: typeof TSPLCommandGroup;
|
|
449
|
+
type index$3_TSPLDensityCommand = TSPLDensityCommand;
|
|
450
|
+
declare const index$3_TSPLDensityCommand: typeof TSPLDensityCommand;
|
|
439
451
|
type index$3_TSPLDiagonal = TSPLDiagonal;
|
|
440
452
|
declare const index$3_TSPLDiagonal: typeof TSPLDiagonal;
|
|
441
453
|
type index$3_TSPLDirectionCommand = TSPLDirectionCommand;
|
|
@@ -460,7 +472,7 @@ type index$3_TSPLVisualCommand = TSPLVisualCommand;
|
|
|
460
472
|
declare const index$3_TSPLVisualCommand: typeof TSPLVisualCommand;
|
|
461
473
|
declare const index$3_alignmentToNumber: typeof alignmentToNumber;
|
|
462
474
|
declare namespace index$3 {
|
|
463
|
-
export { type index$3_Alignment as Alignment, type index$3_AutoManual as AutoManual, type index$3_BarcodeHumanReable as BarcodeHumanReable, type index$3_BarcodeType as BarcodeType, type index$3_ECCLevel as ECCLevel, type index$3_GraphicMode as GraphicMode, type index$3_LabelDirection as LabelDirection, type index$3_QRModel as QRModel, type index$3_Rotation as Rotation, index$3_TSPLBarCommand as TSPLBarCommand, index$3_TSPLBitmapCommand as TSPLBitmapCommand, index$3_TSPLBlockCommand as TSPLBlockCommand, index$3_TSPLCLSCommand as TSPLCLSCommand, index$3_TSPLCommand as TSPLCommand, index$3_TSPLCommandGroup as TSPLCommandGroup, index$3_TSPLDiagonal as TSPLDiagonal, index$3_TSPLDirectionCommand as TSPLDirectionCommand, index$3_TSPLDisplay as TSPLDisplay, index$3_TSPLDownload as TSPLDownload, index$3_TSPLGapCommand as TSPLGapCommand, index$3_TSPLPrintCommand as TSPLPrintCommand, index$3_TSPLQRCommand as TSPLQRCommand, index$3_TSPLRawCommand as TSPLRawCommand, index$3_TSPLSizeCommand as TSPLSizeCommand, index$3_TSPLTextCommand as TSPLTextCommand, index$3_TSPLVisualCommand as TSPLVisualCommand, index$3_alignmentToNumber as alignmentToNumber, _default as commandGenerator };
|
|
475
|
+
export { type index$3_Alignment as Alignment, type index$3_AutoManual as AutoManual, type index$3_BarcodeHumanReable as BarcodeHumanReable, type index$3_BarcodeType as BarcodeType, type index$3_ECCLevel as ECCLevel, type index$3_GraphicMode as GraphicMode, type index$3_LabelDirection as LabelDirection, type index$3_QRModel as QRModel, type index$3_Rotation as Rotation, index$3_TSPLBarCommand as TSPLBarCommand, index$3_TSPLBitmapCommand as TSPLBitmapCommand, index$3_TSPLBlockCommand as TSPLBlockCommand, index$3_TSPLCLSCommand as TSPLCLSCommand, index$3_TSPLCommand as TSPLCommand, index$3_TSPLCommandGroup as TSPLCommandGroup, index$3_TSPLDensityCommand as TSPLDensityCommand, index$3_TSPLDiagonal as TSPLDiagonal, index$3_TSPLDirectionCommand as TSPLDirectionCommand, index$3_TSPLDisplay as TSPLDisplay, index$3_TSPLDownload as TSPLDownload, index$3_TSPLGapCommand as TSPLGapCommand, index$3_TSPLPrintCommand as TSPLPrintCommand, index$3_TSPLQRCommand as TSPLQRCommand, index$3_TSPLRawCommand as TSPLRawCommand, index$3_TSPLSizeCommand as TSPLSizeCommand, index$3_TSPLTextCommand as TSPLTextCommand, index$3_TSPLVisualCommand as TSPLVisualCommand, index$3_alignmentToNumber as alignmentToNumber, _default as commandGenerator };
|
|
464
476
|
}
|
|
465
477
|
|
|
466
478
|
type Point = {
|
|
@@ -547,6 +559,7 @@ declare class Label extends Printable {
|
|
|
547
559
|
private readonly unitSystem;
|
|
548
560
|
private fonts;
|
|
549
561
|
private dpi;
|
|
562
|
+
private density;
|
|
550
563
|
/**
|
|
551
564
|
* List of fields on the label
|
|
552
565
|
*/
|
|
@@ -556,7 +569,7 @@ declare class Label extends Printable {
|
|
|
556
569
|
* Configuration used when generating commands
|
|
557
570
|
*/
|
|
558
571
|
get printConfig(): PrintConfig;
|
|
559
|
-
constructor(width: number, height: number, dimensionUnit?: UnitSystem, dpi?: number);
|
|
572
|
+
constructor(width: number, height: number, dimensionUnit?: UnitSystem, dpi?: number, density?: number);
|
|
560
573
|
commandForLanguage(language: PrinterLanguage, config?: PrintConfig): Promise<Command>;
|
|
561
574
|
/**
|
|
562
575
|
* Place fields to a label
|
package/dist/index.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ interface CommandGenerator<T extends Command> {
|
|
|
110
110
|
/**
|
|
111
111
|
* This should generate the needed commands to set up a label before printing
|
|
112
112
|
*/
|
|
113
|
-
setUp: (width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean, unitSystem: UnitSystem) => T;
|
|
113
|
+
setUp: (width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean, unitSystem: UnitSystem, density: number) => T;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -397,6 +397,16 @@ declare class TSPLDiagonal extends TSPLCommand {
|
|
|
397
397
|
get commandString(): string;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Clear the image buffer
|
|
402
|
+
* {@link /documentsions/TSPL.pdf}
|
|
403
|
+
*/
|
|
404
|
+
declare class TSPLDensityCommand extends TSPLCommand {
|
|
405
|
+
private density;
|
|
406
|
+
constructor(density: number);
|
|
407
|
+
get commandString(): string;
|
|
408
|
+
}
|
|
409
|
+
|
|
400
410
|
/**
|
|
401
411
|
* Command generator for tspl commands
|
|
402
412
|
*/
|
|
@@ -405,7 +415,7 @@ declare class TSPLCommandGenerator implements CommandGenerator<TSPLCommand> {
|
|
|
405
415
|
print(sets: number, copiesPerSet: number): TSPLCommand;
|
|
406
416
|
text(content: string, x: number, y: number, font: string | "default", size: number): TSPLCommand;
|
|
407
417
|
upload(name: string, data: ArrayBuffer | Uint8Array): TSPLCommand;
|
|
408
|
-
setUp(width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean | undefined, unitSystem: UnitSystem): TSPLCommand;
|
|
418
|
+
setUp(width: number, height: number, gap: number, offset: number, direction: LabelDirection, mirror: boolean | undefined, unitSystem: UnitSystem, density: number): TSPLCommand;
|
|
409
419
|
display(): TSPLCommandGroup;
|
|
410
420
|
line(start: Point, end: Point, thickness: number): TSPLCommand;
|
|
411
421
|
image(image: BitmapLike, x: number, y: number, mode?: GraphicMode | undefined): TSPLCommand;
|
|
@@ -436,6 +446,8 @@ type index$3_TSPLCommand = TSPLCommand;
|
|
|
436
446
|
declare const index$3_TSPLCommand: typeof TSPLCommand;
|
|
437
447
|
type index$3_TSPLCommandGroup = TSPLCommandGroup;
|
|
438
448
|
declare const index$3_TSPLCommandGroup: typeof TSPLCommandGroup;
|
|
449
|
+
type index$3_TSPLDensityCommand = TSPLDensityCommand;
|
|
450
|
+
declare const index$3_TSPLDensityCommand: typeof TSPLDensityCommand;
|
|
439
451
|
type index$3_TSPLDiagonal = TSPLDiagonal;
|
|
440
452
|
declare const index$3_TSPLDiagonal: typeof TSPLDiagonal;
|
|
441
453
|
type index$3_TSPLDirectionCommand = TSPLDirectionCommand;
|
|
@@ -460,7 +472,7 @@ type index$3_TSPLVisualCommand = TSPLVisualCommand;
|
|
|
460
472
|
declare const index$3_TSPLVisualCommand: typeof TSPLVisualCommand;
|
|
461
473
|
declare const index$3_alignmentToNumber: typeof alignmentToNumber;
|
|
462
474
|
declare namespace index$3 {
|
|
463
|
-
export { type index$3_Alignment as Alignment, type index$3_AutoManual as AutoManual, type index$3_BarcodeHumanReable as BarcodeHumanReable, type index$3_BarcodeType as BarcodeType, type index$3_ECCLevel as ECCLevel, type index$3_GraphicMode as GraphicMode, type index$3_LabelDirection as LabelDirection, type index$3_QRModel as QRModel, type index$3_Rotation as Rotation, index$3_TSPLBarCommand as TSPLBarCommand, index$3_TSPLBitmapCommand as TSPLBitmapCommand, index$3_TSPLBlockCommand as TSPLBlockCommand, index$3_TSPLCLSCommand as TSPLCLSCommand, index$3_TSPLCommand as TSPLCommand, index$3_TSPLCommandGroup as TSPLCommandGroup, index$3_TSPLDiagonal as TSPLDiagonal, index$3_TSPLDirectionCommand as TSPLDirectionCommand, index$3_TSPLDisplay as TSPLDisplay, index$3_TSPLDownload as TSPLDownload, index$3_TSPLGapCommand as TSPLGapCommand, index$3_TSPLPrintCommand as TSPLPrintCommand, index$3_TSPLQRCommand as TSPLQRCommand, index$3_TSPLRawCommand as TSPLRawCommand, index$3_TSPLSizeCommand as TSPLSizeCommand, index$3_TSPLTextCommand as TSPLTextCommand, index$3_TSPLVisualCommand as TSPLVisualCommand, index$3_alignmentToNumber as alignmentToNumber, _default as commandGenerator };
|
|
475
|
+
export { type index$3_Alignment as Alignment, type index$3_AutoManual as AutoManual, type index$3_BarcodeHumanReable as BarcodeHumanReable, type index$3_BarcodeType as BarcodeType, type index$3_ECCLevel as ECCLevel, type index$3_GraphicMode as GraphicMode, type index$3_LabelDirection as LabelDirection, type index$3_QRModel as QRModel, type index$3_Rotation as Rotation, index$3_TSPLBarCommand as TSPLBarCommand, index$3_TSPLBitmapCommand as TSPLBitmapCommand, index$3_TSPLBlockCommand as TSPLBlockCommand, index$3_TSPLCLSCommand as TSPLCLSCommand, index$3_TSPLCommand as TSPLCommand, index$3_TSPLCommandGroup as TSPLCommandGroup, index$3_TSPLDensityCommand as TSPLDensityCommand, index$3_TSPLDiagonal as TSPLDiagonal, index$3_TSPLDirectionCommand as TSPLDirectionCommand, index$3_TSPLDisplay as TSPLDisplay, index$3_TSPLDownload as TSPLDownload, index$3_TSPLGapCommand as TSPLGapCommand, index$3_TSPLPrintCommand as TSPLPrintCommand, index$3_TSPLQRCommand as TSPLQRCommand, index$3_TSPLRawCommand as TSPLRawCommand, index$3_TSPLSizeCommand as TSPLSizeCommand, index$3_TSPLTextCommand as TSPLTextCommand, index$3_TSPLVisualCommand as TSPLVisualCommand, index$3_alignmentToNumber as alignmentToNumber, _default as commandGenerator };
|
|
464
476
|
}
|
|
465
477
|
|
|
466
478
|
type Point = {
|
|
@@ -547,6 +559,7 @@ declare class Label extends Printable {
|
|
|
547
559
|
private readonly unitSystem;
|
|
548
560
|
private fonts;
|
|
549
561
|
private dpi;
|
|
562
|
+
private density;
|
|
550
563
|
/**
|
|
551
564
|
* List of fields on the label
|
|
552
565
|
*/
|
|
@@ -556,7 +569,7 @@ declare class Label extends Printable {
|
|
|
556
569
|
* Configuration used when generating commands
|
|
557
570
|
*/
|
|
558
571
|
get printConfig(): PrintConfig;
|
|
559
|
-
constructor(width: number, height: number, dimensionUnit?: UnitSystem, dpi?: number);
|
|
572
|
+
constructor(width: number, height: number, dimensionUnit?: UnitSystem, dpi?: number, density?: number);
|
|
560
573
|
commandForLanguage(language: PrinterLanguage, config?: PrintConfig): Promise<Command>;
|
|
561
574
|
/**
|
|
562
575
|
* Place fields to a label
|
package/dist/index.js
CHANGED
|
@@ -193,6 +193,7 @@ __export(tspl_exports, {
|
|
|
193
193
|
TSPLCLSCommand: () => TSPLCLSCommand,
|
|
194
194
|
TSPLCommand: () => TSPLCommand,
|
|
195
195
|
TSPLCommandGroup: () => TSPLCommandGroup,
|
|
196
|
+
TSPLDensityCommand: () => TSPLDensityCommand,
|
|
196
197
|
TSPLDiagonal: () => TSPLDiagonal,
|
|
197
198
|
TSPLDirectionCommand: () => TSPLDirectionCommand,
|
|
198
199
|
TSPLDisplay: () => TSPLDisplay,
|
|
@@ -1409,6 +1410,17 @@ var TSPLDiagonal = class extends TSPLCommand {
|
|
|
1409
1410
|
}
|
|
1410
1411
|
};
|
|
1411
1412
|
|
|
1413
|
+
// src/commands/tspl/commands/basic/TSPLDensityCommand.ts
|
|
1414
|
+
var TSPLDensityCommand = class extends TSPLCommand {
|
|
1415
|
+
constructor(density) {
|
|
1416
|
+
super();
|
|
1417
|
+
this.density = density;
|
|
1418
|
+
}
|
|
1419
|
+
get commandString() {
|
|
1420
|
+
return `DENSITY ${this.density}`;
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1412
1424
|
// src/commands/tspl/commands/basic/TSPLBarcodeCommand.ts
|
|
1413
1425
|
var TSPLBarcodeCommand = class _TSPLBarcodeCommand extends TSPLVisualCommand {
|
|
1414
1426
|
/**
|
|
@@ -1509,11 +1521,12 @@ var TSPLCommandGenerator = class {
|
|
|
1509
1521
|
upload(name, data) {
|
|
1510
1522
|
return new TSPLDownload(name, data);
|
|
1511
1523
|
}
|
|
1512
|
-
setUp(width, height, gap, offset, direction, mirror = false, unitSystem) {
|
|
1524
|
+
setUp(width, height, gap, offset, direction, mirror = false, unitSystem, density) {
|
|
1513
1525
|
const commands = [
|
|
1514
1526
|
new TSPLSizeCommand(width, height, unitSystem),
|
|
1515
1527
|
new TSPLGapCommand(gap, offset, unitSystem),
|
|
1516
1528
|
new TSPLDirectionCommand(direction, mirror),
|
|
1529
|
+
new TSPLDensityCommand(density),
|
|
1517
1530
|
new TSPLCLSCommand()
|
|
1518
1531
|
];
|
|
1519
1532
|
return new TSPLCommandGroup(commands);
|
|
@@ -2401,9 +2414,10 @@ var DEFAULT_FONT_WEIGHT = 400;
|
|
|
2401
2414
|
var DEFAULT_FONT_STYLE = "normal";
|
|
2402
2415
|
var FONT_PREFIX = "f";
|
|
2403
2416
|
var Label = class extends Printable {
|
|
2404
|
-
constructor(width, height, dimensionUnit = "metric", dpi = 203) {
|
|
2417
|
+
constructor(width, height, dimensionUnit = "metric", dpi = 203, density = 8) {
|
|
2405
2418
|
super();
|
|
2406
2419
|
this.fonts = {};
|
|
2420
|
+
this.density = 8;
|
|
2407
2421
|
/**
|
|
2408
2422
|
* List of fields on the label
|
|
2409
2423
|
*/
|
|
@@ -2413,6 +2427,7 @@ var Label = class extends Printable {
|
|
|
2413
2427
|
this.height = height;
|
|
2414
2428
|
this.unitSystem = dimensionUnit;
|
|
2415
2429
|
this.dpi = dpi;
|
|
2430
|
+
this.density = density;
|
|
2416
2431
|
}
|
|
2417
2432
|
/**
|
|
2418
2433
|
* Configuration used when generating commands
|
|
@@ -2515,7 +2530,16 @@ var Label = class extends Printable {
|
|
|
2515
2530
|
return __async(this, null, function* () {
|
|
2516
2531
|
const commands = [
|
|
2517
2532
|
this.fontUploadCommands(generator),
|
|
2518
|
-
generator.setUp(
|
|
2533
|
+
generator.setUp(
|
|
2534
|
+
this.width,
|
|
2535
|
+
this.height,
|
|
2536
|
+
gap,
|
|
2537
|
+
gapOffset,
|
|
2538
|
+
direction,
|
|
2539
|
+
mirror,
|
|
2540
|
+
this.unitSystem,
|
|
2541
|
+
this.density
|
|
2542
|
+
),
|
|
2519
2543
|
yield this.commandForLanguage(language, this.printConfig)
|
|
2520
2544
|
];
|
|
2521
2545
|
return commands;
|