Skip to content

Commit dd83dff

Browse files
committed
[-] Correção no alinhamento da impressão de imagem
[*] Melhorias dos comandos de impressão de imagem. [+] Adicionado leitura de informações no protoclo EscDaruma.
1 parent bb2b543 commit dd83dff

98 files changed

Lines changed: 3790 additions & 3823 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/OpenAC.Net.EscPos.Demo/Form1.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using OpenAC.Net.Devices;
1010
using OpenAC.Net.EscPos.Commom;
1111
using OpenAC.Net.EscPos.Demo.Commom;
12+
using OpenAC.Net.EscPos.Extensions;
1213

1314
namespace OpenAC.Net.EscPos.Demo
1415
{
@@ -356,7 +357,8 @@ private void btnImagem_Click(object sender, EventArgs e)
356357

357358
posprinter.Conectar();
358359

359-
posprinter.ImprimirImagem(img);
360+
posprinter.ImprimirImagem(img.ResizeImage(300, 300), CmdAlinhamento.Centro);
361+
posprinter.PularLinhas(5);
360362
posprinter.CortarPapel();
361363
posprinter.Imprimir();
362364
}

src/OpenAC.Net.EscPos/Command/BarcodeCommand.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,31 @@
3232
using OpenAC.Net.EscPos.Commom;
3333
using OpenAC.Net.EscPos.Interpreter;
3434

35-
namespace OpenAC.Net.EscPos.Command
35+
namespace OpenAC.Net.EscPos.Command;
36+
37+
public sealed class BarcodeCommand : PrintCommand<BarcodeCommand>
3638
{
37-
public sealed class BarcodeCommand : PrintCommand<BarcodeCommand>
38-
{
39-
#region Constructors
39+
#region Constructors
4040

41-
public BarcodeCommand(EscPosInterpreter interpreter) : base(interpreter)
42-
{
43-
}
41+
public BarcodeCommand(EscPosInterpreter interpreter) : base(interpreter)
42+
{
43+
}
4444

45-
#endregion Constructors
45+
#endregion Constructors
4646

47-
#region Properties
47+
#region Properties
4848

49-
public CmdBarcode Tipo { get; set; }
49+
public CmdBarcode Tipo { get; set; }
5050

51-
public string Code { get; set; } = "";
51+
public string Code { get; set; } = "";
5252

53-
public CmdBarcodeText Exibir { get; set; } = CmdBarcodeText.SemTexto;
53+
public CmdBarcodeText Exibir { get; set; } = CmdBarcodeText.SemTexto;
5454

55-
public CmdAlinhamento Alinhamento { get; set; } = CmdAlinhamento.Esquerda;
55+
public CmdAlinhamento Alinhamento { get; set; } = CmdAlinhamento.Esquerda;
5656

57-
public int Altura { get; set; } = 0;
57+
public int Altura { get; set; } = 0;
5858

59-
public int Largura { get; set; } = 0;
59+
public int Largura { get; set; } = 0;
6060

61-
#endregion Properties
62-
}
61+
#endregion Properties
6362
}

src/OpenAC.Net.EscPos/Command/BeepCommand.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@
3131

3232
using OpenAC.Net.EscPos.Interpreter;
3333

34-
namespace OpenAC.Net.EscPos.Command
35-
{
36-
public sealed class BeepCommand : PrintCommand<BeepCommand>
37-
{
38-
#region Constructors
34+
namespace OpenAC.Net.EscPos.Command;
3935

40-
public BeepCommand(EscPosInterpreter interpreter) : base(interpreter)
41-
{
42-
}
36+
public sealed class BeepCommand : PrintCommand<BeepCommand>
37+
{
38+
#region Constructors
4339

44-
#endregion Constructors
40+
public BeepCommand(EscPosInterpreter interpreter) : base(interpreter)
41+
{
4542
}
43+
44+
#endregion Constructors
4645
}

src/OpenAC.Net.EscPos/Command/CashDrawerCommand.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,25 @@
3232
using OpenAC.Net.EscPos.Commom;
3333
using OpenAC.Net.EscPos.Interpreter;
3434

35-
namespace OpenAC.Net.EscPos.Command
35+
namespace OpenAC.Net.EscPos.Command;
36+
37+
public sealed class CashDrawerCommand : PrintCommand<CashDrawerCommand>
3638
{
37-
public sealed class CashDrawerCommand : PrintCommand<CashDrawerCommand>
38-
{
39-
#region Constructors
39+
#region Constructors
4040

41-
public CashDrawerCommand(EscPosInterpreter interpreter) : base(interpreter)
42-
{
43-
}
41+
public CashDrawerCommand(EscPosInterpreter interpreter) : base(interpreter)
42+
{
43+
}
4444

45-
#endregion Constructors
45+
#endregion Constructors
4646

47-
#region Properties
47+
#region Properties
4848

49-
public CmdGaveta Gaveta { get; set; }
49+
public CmdGaveta Gaveta { get; set; }
5050

51-
public byte TempoON { get; set; } = 50;
51+
public byte TempoON { get; set; } = 50;
5252

53-
public byte TempoOFF { get; set; } = 200;
53+
public byte TempoOFF { get; set; } = 200;
5454

55-
#endregion Properties
56-
}
55+
#endregion Properties
5756
}

src/OpenAC.Net.EscPos/Command/CodePageCommand.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,21 @@
3232
using OpenAC.Net.EscPos.Commom;
3333
using OpenAC.Net.EscPos.Interpreter;
3434

35-
namespace OpenAC.Net.EscPos.Command
35+
namespace OpenAC.Net.EscPos.Command;
36+
37+
public sealed class CodePageCommand : PrintCommand<CodePageCommand>
3638
{
37-
public sealed class CodePageCommand : PrintCommand<CodePageCommand>
38-
{
39-
#region Constructors
39+
#region Constructors
4040

41-
public CodePageCommand(EscPosInterpreter interpreter) : base(interpreter)
42-
{
43-
}
41+
public CodePageCommand(EscPosInterpreter interpreter) : base(interpreter)
42+
{
43+
}
4444

45-
#endregion Constructors
45+
#endregion Constructors
4646

47-
#region Properties
47+
#region Properties
4848

49-
public PaginaCodigo PaginaCodigo { get; set; } = PaginaCodigo.pc850;
49+
public PaginaCodigo PaginaCodigo { get; set; } = PaginaCodigo.pc850;
5050

51-
#endregion Properties
52-
}
51+
#endregion Properties
5352
}

src/OpenAC.Net.EscPos/Command/CutCommand.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,21 @@
3131

3232
using OpenAC.Net.EscPos.Interpreter;
3333

34-
namespace OpenAC.Net.EscPos.Command
34+
namespace OpenAC.Net.EscPos.Command;
35+
36+
public sealed class CutCommand : PrintCommand<CutCommand>
3537
{
36-
public sealed class CutCommand : PrintCommand<CutCommand>
37-
{
38-
#region Constructors
38+
#region Constructors
3939

40-
public CutCommand(EscPosInterpreter interpreter) : base(interpreter)
41-
{
42-
}
40+
public CutCommand(EscPosInterpreter interpreter) : base(interpreter)
41+
{
42+
}
4343

44-
#endregion Constructors
44+
#endregion Constructors
4545

46-
#region Properties
46+
#region Properties
4747

48-
public bool Parcial { get; set; } = false;
48+
public bool Parcial { get; set; } = false;
4949

50-
#endregion Properties
51-
}
50+
#endregion Properties
5251
}

src/OpenAC.Net.EscPos/Command/EspacoEntreLinhasCommand.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,21 @@
3232
using System;
3333
using OpenAC.Net.EscPos.Interpreter;
3434

35-
namespace OpenAC.Net.EscPos.Command
35+
namespace OpenAC.Net.EscPos.Command;
36+
37+
public sealed class EspacoEntreLinhasCommand : PrintCommand<EspacoEntreLinhasCommand>
3638
{
37-
public sealed class EspacoEntreLinhasCommand : PrintCommand<EspacoEntreLinhasCommand>
38-
{
39-
#region Constructors
39+
#region Constructors
4040

41-
public EspacoEntreLinhasCommand(EscPosInterpreter interpreter) : base(interpreter)
42-
{
43-
}
41+
public EspacoEntreLinhasCommand(EscPosInterpreter interpreter) : base(interpreter)
42+
{
43+
}
4444

45-
#endregion Constructors
45+
#endregion Constructors
4646

47-
#region Properties
47+
#region Properties
4848

49-
public byte Espaco { get; set; } = 0;
49+
public byte Espaco { get; set; } = 0;
5050

51-
#endregion Properties
52-
}
51+
#endregion Properties
5352
}

src/OpenAC.Net.EscPos/Command/IPrintCommand.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929
// <summary></summary>
3030
// ***********************************************************************
3131

32-
namespace OpenAC.Net.EscPos.Command
32+
namespace OpenAC.Net.EscPos.Command;
33+
34+
public interface IPrintCommand
3335
{
34-
public interface IPrintCommand
35-
{
36-
byte[] Content { get; }
37-
}
36+
byte[] Content { get; }
3837
}

src/OpenAC.Net.EscPos/Command/ImageCommand.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,25 @@
3333
using OpenAC.Net.EscPos.Commom;
3434
using OpenAC.Net.EscPos.Interpreter;
3535

36-
namespace OpenAC.Net.EscPos.Command
36+
namespace OpenAC.Net.EscPos.Command;
37+
38+
public sealed class ImageCommand : PrintCommand<ImageCommand>
3739
{
38-
public sealed class ImageCommand : PrintCommand<ImageCommand>
39-
{
40-
#region Constructors
40+
#region Constructors
4141

42-
public ImageCommand(EscPosInterpreter interpreter) : base(interpreter)
43-
{
44-
}
42+
public ImageCommand(EscPosInterpreter interpreter) : base(interpreter)
43+
{
44+
}
4545

46-
#endregion Constructors
46+
#endregion Constructors
4747

48-
#region Properties
48+
#region Properties
4949

50-
public CmdAlinhamento Alinhamento { get; set; } = CmdAlinhamento.Esquerda;
50+
public CmdAlinhamento Alinhamento { get; set; } = CmdAlinhamento.Esquerda;
5151

52-
public Image Imagem { get; set; }
52+
public Image Imagem { get; set; }
5353

54-
public bool IsHiDPI { get; set; } = false;
54+
public bool IsHiDPI { get; set; } = false;
5555

56-
#endregion Properties
57-
}
56+
#endregion Properties
5857
}

src/OpenAC.Net.EscPos/Command/JumpLineCommand.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,21 @@
3131

3232
using OpenAC.Net.EscPos.Interpreter;
3333

34-
namespace OpenAC.Net.EscPos.Command
34+
namespace OpenAC.Net.EscPos.Command;
35+
36+
public sealed class JumpLineCommand : PrintCommand<JumpLineCommand>
3537
{
36-
public sealed class JumpLineCommand : PrintCommand<JumpLineCommand>
37-
{
38-
#region Constructors
38+
#region Constructors
3939

40-
public JumpLineCommand(EscPosInterpreter interpreter) : base(interpreter)
41-
{
42-
}
40+
public JumpLineCommand(EscPosInterpreter interpreter) : base(interpreter)
41+
{
42+
}
4343

44-
#endregion Constructors
44+
#endregion Constructors
4545

46-
#region Properties
46+
#region Properties
4747

48-
public int Linhas { get; set; } = 1;
48+
public int Linhas { get; set; } = 1;
4949

50-
#endregion Properties
51-
}
50+
#endregion Properties
5251
}

0 commit comments

Comments
 (0)