Code Monkey home page Code Monkey logo

escpos's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

escpos's Issues

ESCPOS vs ESCPOS_NET?

Igoro,
I'm curious why you started a new .net printer library? Were there some architecture/design decisions in ESCPOS_NET that you didn't agree with?

It already has some momentum so it would be nice if we could work together, but if there are some fundamental differences or some reason it doesn't meet your needs, that's fine too.

Best,
-Luke

Rename methods

PrintBarCode and PrintQRCode should be renamed as they don't actually print anything, but rather create the necessary command for a barcode/qrcode.

New name should be just Barcode and QRCode

As this is clearly a breaking change, we should first create the new Barcode() and QRCode() methods which will contain the actual code and the previous PrintBarCode and PrintQRCode must be marked as obsolete methods and instead of containing code, they must only call the newly created methods.

After this change is deployed, version should be bumped to 1.2.4 and the usage of the obsolete methods should just generate a warning by decorating the methods with the Obsolete attribute as shown below.

[Obsolete(nameof(PrintBarCode) + " is deprecated, please use "+ nameof(Barcode) + " instead.")]

On the next version, it must be bumped to 1.3.0 and the Obsolete attribute must be changed in order to throw a compilation error if the old method is used. This can be done by adding a new bool parameter to the attribute

[Obsolete(nameof(PrintBarCode) + " is deprecated, please use "+ nameof(Barcode) + " instead.", true)]

And then, on version 1.3.1 we can just get rid of the old methods :)

Create Extension Method for Barcode and QRCode commands

Dependent on #29

Once the new Barcode and QRCode methods are created, we can create methods that will extend a string (the barcode data) like this

public static byte[] ToBarcode(this string barcode, BarCodeType barCodeType, int heightInDots = 162, BarcodeWidth barcodeWidth = BarcodeWidth.Normal )
  => Commands.Barcode(barCodeType, barcode, heightInDots, barcodeWidth);

Impirmir en español

Hello Igor.

I am trying to print tickets with Spanish accents, for example, the word "address", instead of printing "ó" it prints strange characters.

I tried using "SelectInternationalCharacterSet(CharSet.SpainI)" but it doesn't work, what else can I try?

Saludos, Luis.

Problemas com acentuação

Olá, estou tentando usar seu código para impressão em impressoras térmicas, mas estou com problemas de acentos, você pode me ajudar?

Já tentei usar todo tipo de conversão de encoding e não consigo imprimir corretamente.

Não imprime código de barras CODE128

Olá Igor,

primeiramente parabéns pela sua biblioteca ! Show de bola !

Baixei sua biblioteca para uso no Windows C# .Net Framework 4.7.2 e já fiz alguns testes com sucesso, porém, não consigo imprimir o código de barras CODE128 (para usar no CFe)...

Já testei na Epson TM-T88, na Bematech MP 2800TH, na SWEDA SI-300 e na Gertec G250.

O código ITF vai normal, o QRCODE também mas o CODE128 simplesmente não imprime. (Fica em branco)

Curioso é que eu também tentei a biblioteca ESP-POS-NET do colega Luke e o resultado foi exatamente o mesmo.

Tenho certeza que essas impressoras conseguem imprimir esse código porque usando a biblioteca (DLL) específica de cada uma delas funciona.

Vc consegue dar alguma luz ?

Abaixo o programa de "teste" que estou utilizando:

        byte[] barCodeCommand = PrintBarCode(BarCodeType.ITF, "1234567890");
        barCodeCommand.Print("192.168.34.250:9100");
        byte[] barCodeCommand2 = PrintBarCode(BarCodeType.CODE128, "1234567890");
        barCodeCommand2.Print("192.168.34.250:9100");

Muito agradecido

Daniel Constantinov

To print on USB

Hi, anyone already printed via USB (RAW) using this ESCPOS library ?
On main page of ESCPOS there are examples like:

"... It can be something like COM3, LPT1, \127.0.0.1\printer, 192.168.0.100:9100, etc. or even a path to a text file like ./print.txt."

but are no mention on RAW USB...

All this devices (except LPT1) I tested and is OK, AND when a USB is mapped to Serial Port too, but there is some printers that map only USB device without emulation of serial... (USB001, USB002, etc)

I can´t print on this ports (USB). Anyone could help me ?
Maybe a specific string that I have not used... (??? \USB001 ???)

Thanks

Printing Bar Code128

As stated in the manual:

When using the CODE 128 in this printer, take the following points into account for data transmission: The top of the bar code data string must be code set selection character (any of CODE A, CODE B or CODE C) which selects the first code set.

Your settings for CODE 128 would then be:
0x1D, 0x6B, 0x49, (byte)(barCode.Length + 2), 0x7B, 0x41

I like both ESCPOS and ESCPOS_NET.

CodeTable for windows-1256

Hello,

can you please help me with code table for windows-1256

enum CodeTable already has Windows1252 with value of 16

what is the value of Windows1256 ?

Thanks

SelectCharSizeHeight and SelectCharSizeWidth must be combined?

Hi igorocampos, I noticed your these two commands share the same GS code.

SelectCharSizeHeight(CharSizeHeight charSize)
SelectCharSizeWidth(CharSizeWidth charSize)

0x1D, 0x21, (byte)charSize

When I tried to SelectCharSizeHeight and SelectCharSizeWidth one after another, the previous charSize is lost.

Please see this photo: (I set it to 7(Octuple) for Height and 112(Octuple) for Width with two separate commands)
Effectively, the two commands are:
0x1D, 0x21, 7
0x1D, 0x21, 112
WhatsApp Image 2020-01-16 at 8 30 29 PM

However, when I combine the value 112+7 as 119, with this single command:
0x1D, 0x21, 119

Then only I get the correct 8x + 8x character size:
WhatsApp Image 2020-01-16 at 8 24 11 PM

I tried to workaround with your library by ORing the CharSizeWidth and CharSizeHeight but cannot, because the argument type is either one.

Please look into this... Have a good day!

Datamatrix, code128 + text

4B63D4E9-AD5F-4156-9C1F-E0E764C65676

Does your code support datamatrix?
Can we print from NFC or Bluetooth?
I’m trying to create this label. I don’t understand the ESC/POS language well enough to code this.
LOT37575 is on both bar codes
TUSCAN-DENIM is text
Qty: 25.15 Yards is text

Split Commands class and Add Simple commands alias for possible full commands combinations

Simple ESC/POS Commands are actually just static properties of Commands class. And they are easy on the eye when used.
On the other hand, full commands require parameters, which is good for flexibility but can create a little bit of wordy command concatenation.

The proposal here is to have the class split into 2 files (as a partial Command class), one for the Simple commands and another that will hold all the Commands that are not static properties.

In addition, to be easier on the eye we should create a number of simple commands (static properties) that can be used for the most used combination of parameters used in the full commands. For Example:

  • SelectPrintMode(PrintMode printMode)
    will have the following static properties as aliases

  • PrintModeReset

  • PrintModeFontB

  • PrintModeEmphasis

  • SelectUnderlineMode(UnderlineMode underlineMode)
    will have the following static properties as aliases

  • UnderlineModeOff

  • UnderlineModeOn

Please beware that not all possible combinations should have an alias, only the most used ones. The existing full command methods are not to be deprecated and can still be used for a full usage of the combinations.
Aliases properties should just call the existing full commands as shown below

public static byte[] UnderlineModeOff => SelectUnderlineMode(UnderlineMode.Off);

public static byte[] UnderlineModeOn => SelectUnderlineMode(UnderlineMode.OneDotThick);

Now a list with the name of all simple methods that should be created

  • PrintModeReset
  • PrintModeFontB
  • PrintModeEmphasis
  • UnderlineModeOff
  • UnderlineModeOn
  • DoubleStrikeOn
  • DoubleStrikeOff
  • UseFontA
  • UseFontB
  • AlignToLeft
  • AlignToRight
  • AlignToCenter
  • CharSizeDoubleHeight
  • CharSizeDoubleWidth
  • CharSizeDoubleHeightAndWidth
  • CharSizeReset
  • HRIAboveBarcode
  • HRIBelowBarcode
  • HRINotPrinted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.