ActiveDelphi - Índice do Fórum ActiveDelphi
.: O site do programador Delphi! :.
 
 FAQFAQ   PesquisarPesquisar   MembrosMembros   GruposGrupos   RegistrarRegistrar 
 PerfilPerfil   Entrar e ver Mensagens ParticularesEntrar e ver Mensagens Particulares   EntrarEntrar 

Impressora de Código de Barras Argox PPLA USB

 
Novo Tópico   Responder Mensagem    ActiveDelphi - Índice do Fórum -> Delphi
Exibir mensagem anterior :: Exibir próxima mensagem  
Autor Mensagem
danielfrivas
Novato
Novato


Registrado: Terça-Feira, 25 de Setembro de 2012
Mensagens: 2

MensagemEnviada: Seg Mai 13, 2013 9:28 pm    Assunto: Impressora de Código de Barras Argox PPLA USB Responder com Citação

Olá, , boa noite.

Estou sofrendo há algumas semanas para fazer a impressão na etiqueta de código de barras.

Impressora Argox OS-214 Plus USB, Linguagem PPLA.

Com o programa que veio no CD de instalação, tudo normal, então a impressora está funcionando.

Achei alguns exemplos na internet, mas aqui nada funciona.
Segue:

A_CreatePrn(0, 'PPLA_Example.Prn'); // Inicia Operacao da Impressora
A_Set_Darkness(12); // Seta funcao de Intensidade da impressao

A_Prn_Text(5, 80, 1, 9, 4, 1, 1, 'n', 2, pchar(Copy('NOME DO PRODUTO',1,40))); // nome do produto
A_Prn_Text(118, 45, 1, 3, 5, 2, 1, 'n', 2, pchar('ATACADOR$'));
A_Prn_Text(273, 45, 1, 4, 5, 2, 1, 'n', 2, pchar(Copy('1.50',1,6))); // Preco Atacado
A_Prn_Text(118, 15, 1, 3, 5, 2, 1, 'n', 2, pchar('VAREJOR$'));
//A_Prn_Barcode(1,10,1,'F',2,1,20,'n',0,Pchar('7894222000978')); //

A_Print_Out(1, 1, 1, 1); // Qtade de etiquetas
A_ClosePrn;

------------------------------------------------

Na primeira linha, precisa indicar o nome de um arquivo de linguagem de programação ppla, mas o que deve conter nesse arquivo? Alguém teria um exemplo simples, só para eu poder iniciar?

A_CreatePrn(0, 'PPLA_Example.Prn);

Obrigado!!
Voltar ao Topo
Ver o perfil de Usuários Enviar Mensagem Particular
turbodrive
Novato
Novato


Registrado: Sábado, 25 de Mai de 2013
Mensagens: 1

MensagemEnviada: Sáb Mai 25, 2013 10:23 am    Assunto: Responder com Citação

No seu arquivo PPLA_Example.Prn vai ser escrito os parâmetros de impressão da etiqueta.
Quando você executa o comando A_Print_Out(1, 1, 1, 1), seu sistema está enviando para a impressora padrão. Só que tem um detalhe, você está enviando com comunicação direta, o que não tem efeito em USB (pelo menos é o que eu acho).
Consegui resolver da seguinte forma:
1 - Deixe sua impressora Argox compartilhada;
2 - Salve o arquivo em txt. Ao invés de PPLA_Example.Prn coloque 'C:\teste.txt';
3 - Use um arquivo bat com o ShellExecute, assim:



Código:

var
  ultimp2 : textfile;
  minhaargox : string;

minhaargox := '\\192.168.0.1\ArgoxUsb' --> nome do compartilhamento de sua argox

if not FileExists('C:\Turbo.BAT') then
                        begin
                          AssignFile(ultimp2, 'C:\Turbo.BAT');
                          try
                            Rewrite(ultimp2);
                            Writeln(ultimp2, 'TYPE C:\teste.txt > '+minhaargox);
                          finally
                            CloseFile(ultimp2);
                          end;
                        end;
                      ShellExecute(0, 'Open', PChar('C:\Turbo.BAT'), nil, nil, Ord(SW_HIDE));
sleep(2000);
Deletefile('C:\teste.txt'); //--> apago o arquivo anterior
Deletefile('C:\Turbo.BAT'); // --> apago o bat por precaução, evita access violation


Se a impressora estiver compartilhada e ligada corretamente, funcionará sem problemas. Já uso esse esquema há mais de 4 anos. Não é o mais elegante, mas deixa todo mundo feliz.

Espero ter ajudado.
Voltar ao Topo
Ver o perfil de Usuários Enviar Mensagem Particular
Ghost_Rider
Colaborador
Colaborador


Registrado: Segunda-Feira, 6 de Outubro de 2003
Mensagens: 4437

MensagemEnviada: Sáb Mai 25, 2013 3:58 pm    Assunto: Responder com Citação

Ta apanhando a toa amigo...baixa o ACBr, que é free, e usa o componente deles, tem exemplo e tudo..bem simples...
Voltar ao Topo
Ver o perfil de Usuários Enviar Mensagem Particular
sergiotucano
Novato
Novato


Registrado: Domingo, 19 de Agosto de 2012
Mensagens: 87
Localização: Lorena, SP

MensagemEnviada: Sáb Mai 25, 2013 4:55 pm    Assunto: Responder com Citação

Melhor forma de se trabalhar com cod. de barras e PPLA é via impressão direta.
Da uma olhada no site da argox, lá tem um excelente manual de prog. PPLA para impressão direta.


Wink
Voltar ao Topo
Ver o perfil de Usuários Enviar Mensagem Particular
danielfrivas
Novato
Novato


Registrado: Terça-Feira, 25 de Setembro de 2012
Mensagens: 2

MensagemEnviada: Sáb Mai 25, 2013 6:16 pm    Assunto: Responder com Citação

Com os componentes do ACBR também não consegui, mesmo com o exemplo, a impressora não dava nenhum sinal de vida.

Problema resolvido, abaixo o código utilizado e alguns explicativos utilizando a DLL.

Obrigado a todos!!

procedure TForm1.Button1Click(Sender: TObject);
var
ret,nLen : integer;
pbuf : array[0..127] of AnsiChar;
sCodigoBarras : string;
len1,len2 : integer;
buf1,buf2 : AnsiString;

procedure IniciarImpressora;
begin
ret := 0;
// search port.
nLen := A_GetUSBBufferLen() + 1;

If nLen > 1 then
begin
len1 := 128;
len2 := 128;
SetLength(buf1,len1);
SetLength(buf2,len2);
A_EnumUSB(pbuf);
A_GetUSBDeviceInfo(1, PAnsiChar(buf1), @len1, PAnsiChar(buf2), @len2);
ret := A_CreatePrn(12, PAnsiChar(buf2)); // open usb.
If 0 < ret then
messagebox(handle, 'Erro ao abrir porta USB', 'Porta', mb_iconerror + mb_ok)
else
begin
SetLength(buf1,len1);
SetLength(buf2,len2);
end;
end;

If 0 < ret then
exit;

// sample setting.

A_Set_DebugDialog(1); // 1
A_Set_Unit('n');
A_Set_Syssetting(1, 0, 0, 0, 0);
A_Set_Darkness(20);
A_Del_Graphic(1, '*'); // delete all picture.
A_Clear_Memory(); // clear memory.

end;

begin

IniciarImpressora;


{

A_Prn_Barcode()
===============================================================================
PURPOSE Create a "barcode" object.

SYNTAX
VC:
int A_Prn_Barcode(int x, int y, int ori, char type, int narrow, int width,
int height, char mode, int numeric, LPTSTR data);
VB: VBA:
Declare Function A_Prn_Barcode(ByVal x As Long, ByVal y As Long, _
ByVal ori As Long, ByVal typee As Byte, ByVal narrow As Long, _
ByVal width As Long, ByVal height As Long, ByVal mode As Byte, _
ByVal numeric As Long, ByVal data As String) As Long
VB.net:
Declare Function A_Prn_Barcode(ByVal x As Integer, ByVal y As Integer, _
ByVal ori As Integer, ByVal typee As Byte, ByVal narrow As Integer, _
ByVal width As Integer, ByVal height As Integer, ByVal mode As Byte, _
ByVal numeric As Integer, ByVal data As String) As Integer

PARAMETER
x;
X coordinate.
y;
Y coordinate.
ori;
Orientation or print direction, 1:0¢X¡B2:90¢X¡B3:180¢X¡B4:270¢X
type;
Bar code type as follows:
+==========================================================================+
|Bar code |Length |Check|Type for|Type for |Valid |Bar ratio|
| | |sum |readable|nonreadable|codes | |
| | | |string |string | | |
+============+==========+=====+========+===========+=============+=========+
|Code 3 of 9 |variable |no |'A' |'a' |0~9,A~Z,$%*+-|2:1~ |
| | | | | |./and space |3:1 |
+------------+----------+-----+--------+-----------+-------------+---------+
|UPC-A |12 digis |yes |'B' |'b' |0~9 |2:3:4 |
| |(11+1) | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|UPC-E |7 digits |yes |'C' |'c' |0~9 |2:3:4 |
| |(6+1) | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|Interleaved |variable |no |'D' |'d' |0~9 |2:1~ |
|2 of 5 (I25)| | | | | |3:1 |
+------------+----------+-----+--------+-----------+-------------+---------+
|Code 128 |variable |yes |'E' |'e' |form code 0 |2:3:4 |
| | | | | |to 127 | |
+------------+----------+-----+--------+-----------+-------------+---------+
|EAN-13 |13 digits |yes |'F' |'f' |0~9 |2:3:4 |
| |(12+1) | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|ENA-8 |8 digits |yes |'G' |'g' |0~9 |2:3:4 |
| |(7+1) | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|HBIC |variable |yes |'H' |'h' |0~9,A~Z,$%*+-|2:1~ |
| | | | | |./and space |3:1 |
+------------+----------+-----+--------+-----------+-------------+---------+
|Coda bar |at least 3|no |'I' |'i' |0~9,A~Z,$+-. |2:1~ |
| |characters| | | |And / |3:1 |
+------------+----------+-----+--------+-----------+-------------+---------+
|Interleaved |variable |yes |'J' |'j' |0~9 |2:1~ |
|2 of 5 with +----------+ | | | |3:1 |
|a modulo 10 checksum | | | | | |
+-----------------------+-----+--------+-----------+-------------+---------+
|Plessey |1~14 |yes |'K' |'k' |0~9 |2:1~ |
| |digits | | | | |3:1 |
+------------+----------+-----+--------+-----------+-------------+---------+
|Interleaved |variable |yes |'L' |'l' |0~9 |2:1~ |
|2 of 5 with +----------+-----+--------+-----------+ |3:1 |
|a modulo 10 checksum and shipping bearer bars | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|UPC2 |2 digits |no |'M' |'m' |0~9 |2:3:4 |
+------------+----------+-----+--------+-----------+-------------+---------+
|UPC5 |5 digits |no |'N' |'n' |0~9 |2:3:4 |
+------------+----------+-----+--------+-----------+-------------+---------+
|Code 93 |variable |no |'O' |'o' |0~9,A~Z,$%*+-|2:3:4 |
| | | | | |./and space | |
+------------+----------+-----+--------+-----------+-------------+---------+
|Postnet |variable |yes |not |'p' |0~9 | |
| | | |defined | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|UCC/EAN Code|20 digits |yes |'Q' |'q' |0~9 |2:3:4 |
|128 |(19+1) | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|UCC/EAN Code|18 digits |yes |'R' |'r' |0~9 |2:3:4 |
|128 k-MART | | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|UCC/EAN Code|variable |yes |'S' |'s' |0~9 |2:3:4 |
|128 Random | | | | | | |
|weight | | | | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
|Telepen |variable |yes |'T' |'t' |form code 0 |2:3:4 |
| | | | | |to 127 | |
+------------+----------+-----+--------+-----------+-------------+---------+
|FIM |1 |no |not |'v' |A,B,C and D | |
| |character | |defined | | | |
+------------+----------+-----+--------+-----------+-------------+---------+
Note: Please refer to the Argox PPLA Programmer Manual Section
"A10. PROGRAMMING EXAMPLES FOR BAR CODES"
narrow;
Define the narrow bar width from 0 ~ 24.
width;
Define the wide bar width from 0 ~ 24.
height;
Bar code height. Value:0 ~ 999.
mode;
Add function as follows:
+----+-------------------------------------+
|mode| REMARK |
+----+-------------------------------------+
| A |Make auto increment for numeric. |
+----+-------------------------------------+
| B |Make auto increment for alphanumeric.|
+----+-------------------------------------+
| C |Make auto decrement for numeric. |
+----+-------------------------------------+
| D |Make auto decrement for alphanumeric.|
+----+-------------------------------------+
| N |Disable. |
+----+-------------------------------------+
numeric;
Automaticall increment or decrement the filed value. Value:0 ~ 99.
This field must exist When has add function.
data;
Data string.

RETURN
0 -> OK.
Reference AW-Error.txt file.
}
sCodigoBarras := Edit1.Text;

//sCodigoBarras := '7894222000978';
//sCodigoBarras := '789422200097';



if length(sCodigoBarras) = 13 then
begin

sCodigoBarras := copy(sCodigoBarras, 1, 12);

A_Prn_Barcode(5 // Eixo X (Horizontal)
,5 // Eixo Y (Vertical)
,1
,'F'
,0
,0
,35
,'N'
,0
,PChar(sCodigoBarras));

end
else
begin



A_Prn_Barcode(10 // Eixo X (Horizontal)
,1 // Eixo Y (Vertical)
,1 // 1 = Normal, 2 = 90 Graus, 180 = 180 Graus, 270 = 270 Graus
,'E'
,0
,0
,35
,'N'
,0
,PChar(sCodigoBarras));


A_Prn_Barcode(140 // Eixo X (Horizontal)
,1 // Eixo Y (Vertical)
,1 // 1 = Normal, 2 = 90 Graus, 180 = 180 Graus, 270 = 270 Graus
,'E'
,0
,0
,35
,'N'
,0
,PChar(sCodigoBarras));



A_Prn_Barcode(270 // Eixo X (Horizontal)
,1 // Eixo Y (Vertical)
,1 // 1 = Normal, 2 = 90 Graus, 180 = 180 Graus, 270 = 270 Graus
,'E'
,0
,0
,35
,'N'
,0
,PChar(sCodigoBarras));




end;


{A_Prn_Text

PARAMETER
x;
X coordinate.
y;
Y coordinate.
ori;
Orientation or print direction, 1:0¢X¡B2:90¢X¡B3:180¢X¡B4:270¢X
font;
Font type as follows:
Note:Refer to the font tables in User's Manual.
type;
As follows:
+--------------+-----+---------------------------+
|font |type |Font Type |
+--------------+-----+---------------------------+
|0,1,2,3,4,5,6,|0 |font 0~font 8 respectively.|
|7,8 | | |
+--------------+-----+---------------------------+
|9 |0~7 |ASD smooth fonts. |
| | |0:4points, 1:6points, |
| | |2:8points, 3:10points, |
| | |4:12points, 5:14points, |
| | |6:18points. |
+--------------+-----+---------------------------+
|9 |xxx |PCL soft font. |
| | |xxx : soft font ID with |
| | | 3 digits |
+--------------+-----+---------------------------+
|11 |0~7 |Courier fonts,(0 represents|
| | |symbol set) |
| | |0:Roman-8, 1:ECMA-94, |
| | |2:PC set, 3:PC set A, |
| | |4:PC set B, 5:Legal, |
| | |6:Greek, 7:Russian. |
+--------------+-----+---------------------------+
|12 |0 |Font selection form font |
| | |board. |
+--------------+-----+---------------------------+
hor_factor;
Horizontal scale factor. Value:1 ~ 24
ver_factor;
Vertical scale factor. Value:1 ~ 24
mode;
Add function as follows:
+----+-------------------------------------+
|mode| REMARK |
+----+-------------------------------------+
| A |Make auto increment for numeric. |
+----+-------------------------------------+
| B |Make auto increment for alphanumeric.|
+----+-------------------------------------+
| C |Make auto decrement for numeric. |
+----+-------------------------------------+
| D |Make auto decrement for alphanumeric.|
+----+-------------------------------------+
| M |Toggle the mirror mode. |
+----+-------------------------------------+
| N |Disable. |
+----+-------------------------------------+
numeric;
Automaticall increment or decrement the filed value. Value:0 ~ 99.
This field must exist When has add function.
data;
Data string.

RETURN
0 -> OK.
}


A_Prn_Text(10 // Eixo X (Horizontal)
,47 // Eixo Y (Vertical)
,1 // 1 = Normal, 90 = 90 Graus, 180 = 180 Graus, 270 = 270 Graus
,2 // Tamanho da font
,0
,1 // Tamanho Horizontal
,1 // Tamanho Vertical
,'N'
,2
,'ABCDEFGHIJKLMNOPQ');

A_Prn_Text(140 // Eixo X (Horizontal)
,47 // Eixo Y (Vertical)
,1 // 1 = Normal, 90 = 90 Graus, 180 = 180 Graus, 270 = 270 Graus
,2 // Tamanho da font
,0
,1 // Tamanho Horizontal
,1 // Tamanho Vertical
,'N'
,2
,'Coluna 2');

A_Prn_Text(270 // Eixo X (Horizontal)
,47 // Eixo Y (Vertical)
,1 // 1 = Normal, 90 = 90 Graus, 180 = 180 Graus, 270 = 270 Graus
,2 // Tamanho da font
,0
,1 // Tamanho Horizontal
,1 // Tamanho Vertical
,'N'
,2
,'Coluna 3');





A_Clear_Memory(); // clear memory.

// output.
A_Print_Out(1, 1, 2, 1); // copy 2.

// close port.
A_ClosePrn();

end;
Voltar ao Topo
Ver o perfil de Usuários Enviar Mensagem Particular
Mostrar os tópicos anteriores:   
Novo Tópico   Responder Mensagem    ActiveDelphi - Índice do Fórum -> Delphi Todos os horários são GMT - 3 Horas
Página 1 de 1

 
Ir para:  
Enviar Mensagens Novas: Proibido.
Responder Tópicos Proibido
Editar Mensagens: Proibido.
Excluir Mensagens: Proibido.
Votar em Enquetes: Proibido.


Powered by phpBB © 2001, 2005 phpBB Group
Traduzido por: Suporte phpBB