Skip to content

Commit

Permalink
Agregada opción para cortar papel
Browse files Browse the repository at this point in the history
  • Loading branch information
parzibyte committed Aug 27, 2019
1 parent 0eeead7 commit 2799115
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Impresora.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
const C = {
AccionWrite: "write",
AccionCut: "cut",
AccionAlign: "align",
AccionFontSize: "fontsize",
AccionFont: "font",
Expand Down Expand Up @@ -55,6 +56,10 @@ class Impresora {
.then(r => r.json());
}

cut() {
this.operaciones.push(new OperacionTicket(C.AccionCut, ""));
}

setFontSize(a, b) {
this.operaciones.push(new OperacionTicket(C.AccionFontSize, `${a},${b}`));
}
Expand Down
1 change: 1 addition & 0 deletions ejemplos/simple/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ $btnImprimir.addEventListener("click", () => {
impresora.write("Fuente B\n");
impresora.feed(2);
impresora.write("Separado por 2\n");
impresora.cut();
impresora.end()
.then(valor => {
loguear("Al imprimir: " + valor);
Expand Down
1 change: 1 addition & 0 deletions ejemplos/ticket/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ $btnImprimir.addEventListener("click", () => {
impresora.write("--------------------------------\n");
impresora.setAlign("center");
impresora.write("***Gracias por su compra***");
impresora.cut();
impresora.end()
.then(valor => {
loguear("Al imprimir: " + valor);
Expand Down

0 comments on commit 2799115

Please sign in to comment.