Closed Dtuzzy closed 3 years ago
hi @Dtuzzy, try something like this:
public void printLogo() throws IOException {
PrintService printService = PrinterOutputStream.getPrintServiceByName("TM-T20");
EscPos escpos = new EscPos(new PrinterOutputStream(printService));
BufferedImage bufferedImage = ImageIO.read(new File("/home/marco/desenv/dog.png"));
CoffeeImage coffeeImage = new CoffeeImageImpl(bufferedImage);
Bitonal algorithm = new BitonalOrderedDither();
GraphicsImageWrapper imageWrapper = new GraphicsImageWrapper();
imageWrapper.setJustification(EscPosConst.Justification.Center);
EscPosImage escposImage = new EscPosImage(coffeeImage, algorithm);
escpos.writeLF("Printing one image");
escpos.write(imageWrapper, escposImage);
escpos.feed(3).cut(EscPos.CutMode.FULL);
escpos.close();
}
if you are building for android, take a look at https://github.com/anastaciocintra/escpos-coffee-samples/tree/master/miscellaneous/AndroidImage
Hi @Dtuzzy , Is all right about this problem?
The constructor EscPosImage(BufferedImage, BitonalThreshold) is undefined
This happens when I do this BufferedImage githubBufferedImage = ImageIO.read(new File("pinlogo.gif")); EscPosImage escposImage = new EscPosImage(githubBufferedImage, new BitonalThreshold());