lsongdev / node-escpos

🖨️ ESC/POS Printer driver for Node.js
https://npmjs.org/escpos
Other
1.38k stars 423 forks source link

Images with white straps #346

Closed rodolphocarvalho closed 3 years ago

rodolphocarvalho commented 3 years ago

Hi, when I try to print images, they are getting white stripes I tried other images and the same issue happens the code is that what could be happening?

const logo = path.join(__dirname, 'tux.png');
escpos.Image.load(logo, function(image){

  networkDevice.open(function(){

    printer
    .align('ct')
           .image(image, 's8')
           .then(() => { 
              printer.cut().close(); 
           });

    // OR non-async .raster(image, "mode") : printer.text("text").raster(image).cut().close();

  });

});

https://user-images.githubusercontent.com/66786177/112884940-7e211400-90a6-11eb-98e8-b74cf830de97.jpg

rodolphocarvalho commented 3 years ago

I solved the problem using that

printer.raster(image)

and not

.image(image, 's8')
   .then(() => { 
    printer.cut().close(); 
});
goclases03 commented 1 month ago

Hola, cuando intento imprimir imágenes, aparecen rayas blancas. Probé con otras imágenes y ocurre el mismo problema. ¿Cuál es el código que podría estar pasando?

const logo = path.join(__dirname, 'tux.png');
escpos.Image.load(logo, function(image){

  networkDevice.open(function(){

    printer
    .align('ct')
           .image(image, 's8')
           .then(() => { 
              printer.cut().close(); 
           });

    // OR non-async .raster(image, "mode") : printer.text("text").raster(image).cut().close();

  });

});

https://user-images.githubusercontent.com/66786177/112884940-7e211400-90a6-11eb-98e8-b74cf830de97.jpg

use printer.raster(image);