forked from BuildingIntelligence/dymo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (28 loc) · 1.15 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const xml = require('xml2json');
const api = require('./dymo-frontend.js');
module.exports.printers = function () {
return dymo.label.framework.getPrinters();
}
module.exports.print = function (what) {
let labelFile = dymo.label.framework.openLabelFile(what.label);
let objectNames = labelFile.getObjectNames();
if(what.fields){
for(var field of fields){
if(objectNames.indexOf(field) >= 0){
labelFile.setObjectText(field, what.fields[field]);
}
}
}
if(what.images){
for(var image of images){
if(objectNames.indexOf(image) >= 0){
labelFile.setObjectText(field, what.images[field]);
}
}
}
labelFile.print(what.printer, dymo.label.framework.createLabelPrintParamsXml(), dymo.label.framework.LabelSetBuilder.toXml([]));
}
module.exports.printMany = function (labelFileURI, printer, fields) {
let labelFile = dymo.label.framework.openLabelFile(what.label);
labelFile.print(printer, dymo.label.framework.createLabelPrintParamsXml(), dymo.label.framework.LabelSetBuilder.toXml(fields));
}