anastaciocintra / escpos-coffee

Java library for ESC/POS printer
https://anastaciocintra.github.io/escpos-coffee
MIT License
280 stars 74 forks source link

necesito ayuda estoy tratando de imprimir una imagen pero me salen otros caracteres #65

Closed anastaciocintra closed 3 years ago

anastaciocintra commented 3 years ago

necesito ayuda estoy tratando de imprimir una imagen pero me salen otros caracteres

Originally posted by @JulioCesarQ in https://github.com/anastaciocintra/escpos-coffee/issues/44#issuecomment-812454804

anastaciocintra commented 3 years ago

Hi @JulioCesarQ Ok What is your printer brand and model? Can you share the piece of code with problem ?

JulioCesarQ commented 3 years ago

modelo de impresora APT-AP300

Code

  public static void main(String[] args) {
          try {
              PrintService printService = PrinterOutputStream.getPrintServiceByName("JM 9-pin printer wide");
              PrinterOutputStream printerOutputStream = new PrinterOutputStream(printService);
              EscPos escpos = new EscPos(printerOutputStream);

              PDDocument document = PDDocument.load(ClassLoader.getSystemResourceAsStream("archivo.pdf"));
              PDFRenderer pdfRenderer = new PDFRenderer(document);
              int nu = document.getNumberOfPages();

              for (int i = 0; i < nu; i++) {
                  BufferedImage image = pdfRenderer.renderImage(i);

                  new ImageHelper().write(escpos, new CoffeeImageImpl(image), new RasterBitImageWrapper(),
                          new BitonalOrderedDither());
                  escpos.feed(3).cut(EscPos.CutMode.PART);
              }
               document.close();
          } catch (Exception e) {
              // TODO: handle exception
              e.printStackTrace();
          }

      }
anastaciocintra commented 3 years ago

hi @JulioCesarQ , is this your printer? https://apt-pos.com/impresora-matriz/38-apt-ap300.html

JulioCesarQ commented 3 years ago

si esa es la impresora Yes!

anastaciocintra commented 3 years ago

ok, this printer is compatible with ESC/P pattern and not totally compatible with ESC/POS

see, on "Especificaciones" "Compatibilidad: EPSON LX 300."

and about EPSON LX 300: https://github.com/mike42/escpos-php/issues/871

In other words this library (escpos-coffee) isn't recommended to be used with APT-AP300.