CODIGO FONTE PARA IMPRIMIR ETIQUETAS EM VB6

VILSONFRIES 10/02/2012 23:42:21
#394469
olá pessoal,
tenho um sistema em vb6, preciso implantar a impressão de etiquetas nele (ARGOX), alguem poderia postar um código fonte para eu ter uma idéia de como fazer
preciso imprimir a > descrição do produto > Código de barras > e preço >
desde já agradeço a quem me ajudar.
AJSO 11/02/2012 01:04:44
#394472
Resposta escolhida
Caro VILSONFRIES

Vc tem alguma informação sobre modelo e tipo de conexão da impressora(Serial, Paralela USB)

Plataforma de Instalação de sua impressora (Windows 7, Win 98, ME, 2000, NT, 2003, XP, windows Vista x86)

São alguns dos métodos utilizado nesse fabricante de impressora conforme modelo:

Tecnologia de impressão
Direct Thermal
Thermal Transfer

Tipos de Emuladores
PPLA ([Ô]D[Ô] brand emulation)
PPLB ([Ô]E[Ô] brand emulation)
PPLZ ([Ô]Z[Ô] brand emulation)

Com estas informações posso passar alguns dos comandos (Similar BEMATECH, SWEDA, DARUMA, Elgin, Epson, DataRegis, ItauTec, IBM, etc...)
Este fabricante é um pouco diferente no aspecto de ligação com a impressora mas é similar quanto ao chamdo do comando e envio e recebimento com a impressora.

Este Fabricante de Impressora é para impressão de etiquetas auto adesivas, Tickets(Senhas, Vendas, ingresso ou comprovantes) entre outros com leitura de BARCODE e não faz relatórios ou tipos de CUPONS fiscais

Boa sorte
VILSONFRIES 11/02/2012 22:25:57
#394511
A impressora é uma Argox modelo OS-214plus
ela tem saída Serial, Paralela e USB
plataforma Windows Xp
AJSO 12/02/2012 16:45:51
#394537
Citação:

:
A impressora é uma Argox modelo OS-214plus
ela tem saída Serial, Paralela e USB
plataforma Windows Xp




Ok vou adicionar alguns Comando de exemplo para esta impressora e deixo aqui......


Boa Sorte
CASSIOJFF 12/02/2012 18:50:51
#394539
Eu ja usei esse codigo em um programa meu ha algum tempo atras.... ve se serve pra vc



Private Declare Function A_CreatePrn Lib [Ô]WINPPLA.DLL[Ô] (ByVal selection As Long, ByVal filename As String) As Long
Private Declare Sub A_ClosePrn Lib [Ô]WINPPLA.DLL[Ô] ()
Private Declare Function A_Print_Out Lib [Ô]WINPPLA.DLL[Ô] (ByVal Width As Long, ByVal Height As Long, ByVal copies As Long, ByVal amount As Long) As Long
Private Declare Function A_Bar2d_Maxi Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal primary As Long, ByVal secondary As Long, ByVal country As Long, ByVal service As Long, ByVal mode As Byte, ByVal numeric As Long, ByVal Data As String) As Long
Private Declare Function A_Bar2d_Maxi_Ori Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal ori As Long, ByVal primary As Long, ByVal secondary As Long, ByVal country As Long, ByVal service As Long, ByVal mode As Byte, ByVal numeric As Long, ByVal Data As String) As Long
Private Declare Function A_Bar2d_PDF417 Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal narrow As Long, ByVal Width As Long, ByVal normal As Byte, ByVal security As Long, ByVal aspect As Long, ByVal row As Long, ByVal Column As Long, ByVal mode As Byte, ByVal numeric As Long, ByVal Data As String) As Long
Private Declare Function A_Bar2d_PDF417_Ori Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal ori As Long, ByVal narrow As Long, ByVal Width As Long, ByVal normal As Byte, ByVal security As Long, ByVal aspect As Long, ByVal row As Long, ByVal Column As Long, ByVal mode As Byte, ByVal numeric As Long, ByVal Data As String) As Long
Private Declare Function A_Bar2d_DataMatrix Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal rotation As Long, ByVal hor_mul As Long, ByVal ver_mul As Long, ByVal ECC As Long, ByVal data_format As Long, ByVal num_rows As Long, ByVal num_col As Long, ByVal mode As Byte, ByVal numeric As Long, ByVal Data As String) As Long
Private Declare Function A_Prn_Barcode Lib [Ô]WINPPLA.DLL[Ô] (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
Private Declare Function A_Prn_Text Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal ori As Long, ByVal font As Long, ByVal typee As Long, ByVal hor_factor As Long, ByVal ver_factor As Long, ByVal mode As Byte, ByVal numeric As Long, ByVal Data As String) As Long
Private Declare Function A_Open_ChineseFont Lib [Ô]WINPPLA.DLL[Ô] (ByVal path As String) As Long
Private Declare Function A_Prn_Text_Chinese Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal fonttype As Long, ByVal id_name As String, ByVal Data As String, ByVal mem_mode As Long) As Long
Private Declare Function A_Prn_Text_TrueType Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal FSize As Long, ByVal FType As String, ByVal Fspin As Long, ByVal FWeight As Long, ByVal FItalic As Long, ByVal FUnline As Long, ByVal FStrikeOut As Long, ByVal id_name As String, ByVal Data As String, ByVal mem_mode As Long) As Long
Private Declare Function A_Prn_Text_TrueType_W Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal FHeight As Long, ByVal FWidth As Long, ByVal FType As String, ByVal Fspin As Long, ByVal FWeight As Long, ByVal FItalic As Long, ByVal FUnline As Long, ByVal FStrikeOut As Long, ByVal id_name As String, ByVal Data As String, ByVal mem_mode As Long) As Long
Private Declare Function A_Draw_Box Lib [Ô]WINPPLA.DLL[Ô] (ByVal mode As Byte, ByVal X As Long, ByVal Y As Long, ByVal Width As Long, ByVal Height As Long, ByVal Top As Long, ByVal side As Long) As Long
Private Declare Function A_Draw_Line Lib [Ô]WINPPLA.DLL[Ô] (ByVal mode As Byte, ByVal X As Long, ByVal Y As Long, ByVal Width As Long, ByVal Height As Long) As Long
Private Declare Function A_Get_Graphic Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal mem_mode As Long, ByVal format As Byte, ByVal filename As String) As Long
Private Declare Function A_Get_Graphic_ColorBMP Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal mem_mode As Long, ByVal format As Byte, ByVal filename As String) As Long
Private Declare Function A_Load_Graphic Lib [Ô]WINPPLA.DLL[Ô] (ByVal X As Long, ByVal Y As Long, ByVal Graphic_name As String) As Long
Private Declare Function A_Del_Graphic Lib [Ô]WINPPLA.DLL[Ô] (ByVal mem_mode As Long, ByVal Graphic As String) As Long
Private Declare Function A_Set_Backfeed Lib [Ô]WINPPLA.DLL[Ô] (ByVal back As Long) As Long
Private Declare Function A_Set_BMPSave Lib [Ô]WINPPLA.DLL[Ô] (ByVal nSave As Long, ByVal pstrBMPFName As String) As Long
Private Declare Function A_Set_Cutting Lib [Ô]WINPPLA.DLL[Ô] (ByVal cutting As Long) As Long
Private Declare Function A_Set_Darkness Lib [Ô]WINPPLA.DLL[Ô] (ByVal darkness As Long) As Long
Private Declare Function A_Set_DebugDialog Lib [Ô]WINPPLA.DLL[Ô] (ByVal nEnable As Long) As Long
Private Declare Function A_Set_Feed Lib [Ô]WINPPLA.DLL[Ô] (ByVal rate As Byte) As Long
Private Declare Function A_Set_Form Lib [Ô]WINPPLA.DLL[Ô] (ByVal formfile As String, ByVal form_name As String, ByVal mem_mode As Long) As Long
Private Declare Function A_Set_Margin Lib [Ô]WINPPLA.DLL[Ô] (ByVal position As Long, ByVal margin As Long) As Long
Private Declare Function A_Set_Prncomport Lib [Ô]WINPPLA.DLL[Ô] (ByVal baud As Long, ByVal parity As Long, ByVal Data As Long, ByVal sstop As Long) As Long
Private Declare Function A_Set_Prncomport_PC Lib [Ô]WINPPLA.DLL[Ô] (ByVal nBaudRate As Long, ByVal nByteSize As Long, ByVal nParity As Long, ByVal nStopBits As Long, ByVal nDsr As Long, ByVal nCts As Long, ByVal nXonXoff As Long) As Long
Private Declare Function A_Set_Sensor_Mode Lib [Ô]WINPPLA.DLL[Ô] (ByVal ttype As Byte, ByVal continuous As Long) As Long
Private Declare Function A_Set_Speed Lib [Ô]WINPPLA.DLL[Ô] (ByVal speed As Byte) As Long
Private Declare Function A_Set_Syssetting Lib [Ô]WINPPLA.DLL[Ô] (ByVal transfer As Long, ByVal cut_peel As Long, ByVal length As Long, ByVal zero As Long, ByVal pause As Long) As Long
Private Declare Function A_Set_Unit Lib [Ô]WINPPLA.DLL[Ô] (ByVal unit As Byte) As Long
Private Declare Function A_Set_Logic Lib [Ô]WINPPLA.DLL[Ô] (ByVal Logic As Long) As Long
Private Declare Function A_Set_ProcessDlg Lib [Ô]WINPPLA.DLL[Ô] (ByVal nShow As Long) As Long
Private Declare Function A_Set_LabelVer Lib [Ô]WINPPLA.DLL[Ô] (ByVal centiInch As Long) As Long
Private Declare Sub A_Clear_Memory Lib [Ô]WINPPLA.DLL[Ô] ()
Private Declare Sub A_Feed_Label Lib [Ô]WINPPLA.DLL[Ô] ()
Private Declare Function A_Get_DLL_Version Lib [Ô]WINPPLA.DLL[Ô] (ByVal nShowMessage As Long) As String
Private Declare Function A_Get_DLL_VersionA Lib [Ô]WINPPLA.DLL[Ô] (ByVal nShowMessage As Long) As Long
Private Declare Function A_Initial_Setting Lib [Ô]WINPPLA.DLL[Ô] (ByVal ttype As Long, ByVal Source As String) As Long
Private Declare Function A_Print_Form Lib [Ô]WINPPLA.DLL[Ô] (ByVal Width As Long, ByVal Height As Long, ByVal copies As Long, ByVal amount As Long, ByVal form_name As String) As Long
Private Declare Function A_GetUSBBufferLen Lib [Ô]WINPPLA.DLL[Ô] () As Long
Private Declare Function A_EnumUSB Lib [Ô]WINPPLA.DLL[Ô] (ByVal buf As String) As Long
Private Declare Function A_CreateUSBPort Lib [Ô]WINPPLA.DLL[Ô] (ByVal nPort As Long) As Long


Ret = A_CreatePrn(1, [Ô]Et23[Ô])
Ret = A_Set_Darkness(10)
Ret = A_Prn_Barcode(10, 0, 1, 70, 2, 2, 30, 78, 0, Mid(rsEstoque!Ean, 1, 12))
Ret = A_Prn_Barcode(180, 0, 1, 70, 2, 2, 30, 78, 0, Mid(rsEstoque!Ean, 1, 12))

Linhas = CarregaTextoMemo(LineWrap(format(SubstituiAcentos(rsEstoque!Descricao), [Ô]>[Ô]), 18))
muda = 0
For X = 1 To Linhas
Ret = A_Prn_Text(180, 135 - muda, 1, 2, 1, 1, 1, 110, 2, TextoMemo(X))
muda = muda + 13
Next X
Ret = A_Prn_Text(180, 100, 1, 3, 1, 1, 1, 110, 2, [Ô]REF. [Ô] & format(MostraReferencia(rsEstoque!codprec), [Ô]00000#[Ô]))
muda = 0
Ret = A_Prn_Text(180, 45, 1, 2, 1, 1, 1, 110, 2, [Ô]COR:[Ô] & format(Cor, [Ô]>[Ô]))
Ret = A_Prn_Text(180, 110, 1, 2, 1, 1, 1, 110, 2, [Ô]TAM: [Ô] & MostraTamanho(rsEstoque!Ean))
Ret = A_Prn_Text(10, 110, 1, 2, 1, 1, 1, 110, 2, [Ô]TAM: [Ô] & MostraTamanho(rsEstoque!Ean))
Ret = A_Prn_Text(10, 45, 1, 2, 1, 1, 1, 110, 2, [Ô]COR:[Ô] & format(Cor, [Ô]>[Ô]))
muda = 0
Ret = A_Prn_Text(10, 100, 1, 3, 1, 1, 1, 110, 2, [Ô]REF. [Ô] & format(MostraReferencia(rsEstoque!codprec), [Ô]00000#[Ô]))
Linhas = CarregaTextoMemo(LineWrap(format(SubstituiAcentos(rsEstoque!Descricao), [Ô]>[Ô]), 18))
muda = 0
For X = 1 To Linhas
Ret = A_Prn_Text(10, 135 - muda, 1, 2, 1, 1, 1, 110, 2, TextoMemo(X))
muda = muda + 13
Next X
Ret = A_Print_Out(1, 1, Qta, 1)
Call A_ClosePrn
AJSO 13/02/2012 18:59:51
#394622
Caro VILSONFRIES

Este teste de impressão ARGOX n o modelo PPLA

Segue o arquivo em anexo para vc testar conexão com a impressora USB!!!!!!!


Boa Sorte
VILSONFRIES 14/02/2012 01:34:16
#394638
Caro amigo Alessandro,
Testei o código e deu certo no USB, só dá o seguinte erro antes de imprimir

DLL Version: 4.03 AW
Open USB:
Device name: ARGOX OS-214 plus PPLA
Device path:\\?\USB#Vid_019a#000000001#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

será que fiz algo errado?

Se não for abusar do amigo, tem como imprimir a etiqueta direto da tabela do BD do programa? se puder postar os comandos lhe agradeço.
meu banco se chama Master.sql preciso só da descrição, preço e código de barras na etiqueta
Estou iniciando em VB e meu primo tem um supermercado e precisa imprimir etiquetas de gondula ele tem o código fonte do programa, aí tô tentando ajuda-lo.
Muito obrigado!
AJSO 14/02/2012 15:10:26
#394704
Caro VILSONFRIES

O que posso dizer é que sua porta USB onde apresenta uma incompatibilidade no comando

no código que lhe passei tem a seguinte classe ClsPrint.cls

e a linha de código e dentro da função publica...........

[ô]Abre a impressora
Public Function ImpressoraAbertura(ByVal strCPF_CNPJ As String) As Integer

Localiza a caixa de menssagem e comente esta linha ========= MsgBox (strmsg) =======

deixando assim======== [txt-color=#007100][ô]MsgBox (strmsg)[/txt-color] ======

QUANTO AO IMPRIMIR DIRETO DO BANCO SIM ESTE CÓDIGO ESTA PREPARADO PARA RECEBER SEUS PARAMETROS COM INFORMAÇÕES DO BD.

NO FORMULÁRIO FrmTela.frm

O botão Private Sub cmdPrint_Click()

tem a chamada do processo da impressora

nesta linha

i = prn.ImpressoraItem(txtDsc.Text, txtBarCode.Text, CDbl(txtValor.Text))

é só substituir os TextBox.Text que estão pelas variáveis que vem do banco.

Dentro da Função Publica ImpressoraItem tem os 03 comando que utilizo neste pequeno exemplo Para DESCRIÇÃO, CÓDIGO DE BARRAS, VALOR

[ô]Descrição
Call A_Prn_Text(2, 30, 1, 2, 0, 1, 1, Asc([Ô]N[Ô]), 2, descricao)

[ô]Código de Barras (Verificar o moldelo de Código de Barras que vc quer imprimir)
Call A_Prn_Barcode(220, 60, 1, Asc([Ô]A[Ô]), 0, 0, 20, Asc([Ô]B[Ô]), 1, barcode)

[ô]Valor
Call A_Prn_Text(20, 30, 1, 2, 0, 1, 1, Asc([Ô]N[Ô]), 2, valor)

[ô] Saida.
Call A_Print_Out(1, 1, 1, 1) [ô] Total de 1 etiqueta.

[ô] Fecha porta.
Call A_ClosePrn

é preciso formatar cada comando para atender sua especifucação de dimenssão e formato da etiqueta X,Y,Z,W de sua etiqueta caso queira implementar estes comandos.
Para implementar em seu código fonte é preciso analisar o que vc tem e onde pode ser implementado para não causar erros ou mal funcionamento de todo o processo.


Quanto a esta menssagem não se trata de ERRO mas sim um tratamento no camando [ô]Abrir USB
-----------------------------------------------------------------------------------------------------------------------
DLL Version: 4.03 AW
Open USB:
Device name: ARGOX OS-214 plus PPLA
Device path:\\?\USB#Vid_019a#000000001#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
-----------------------------------------------------------------------------------------------------------------------

Dentro da Classe ClsPrint.cls

tem estas linhas na Função Publica impressoraAbertura()

If 0 < ret Then
strmsg = strmsg + [Ô]Open USB fail![Ô]
Else
strmsg = strmsg + [Ô]Open USB:[Ô] + vbCrLf + [Ô]Device name: [Ô]
strmsg = strmsg + Left(buf1, len1)
strmsg = strmsg + vbCrLf + [Ô]Device path: [Ô]
strmsg = strmsg + Left(buf2, len2)
End If

O ret é maior ou igual a zero então faz a ãbertura da impressora na USB

Uma outra observação, para implementar estes comandos diretamente nos seus fontes teria que analizalo para adicionar os camando da impressora e se tem a necessidade de implementar outros que esta impressora utiliza por questões de segurança inclusive com retorno de informações da impressora.

Boa Sorte
VILSONFRIES 20/02/2012 02:47:49
#395113
Caro amigos,
Coloquei no codigo fonte de meu sistema e tá funcionando perfeito, só não consigo fazer imprimir os digitos no final Ex: 1,90 imprime 1,9
o que devo fazer?

no que estou errando?

Dim prn As New ClsPrint

[ô]Prepara a Tela para inclusão de Dados
Private Sub PreparaForm()
txtDsc.Text = [Ô][Ô]
txtBarCode.Text = [Ô][Ô]
txtValor.Text = [Ô][Ô]
End Sub


Private Sub cmdCancelar_Click()
Unload Me
End Sub

Private Sub cmdPrint_Click()
Dim i As Integer

[ô]Caso haja necessidade verificação de impressora ligada
i = prn.VerificaImpressoraLigada

If i = 1 Then
[ô]Caso haja necessidade de abertura de impressão
i = prn.ImpressoraAbertura([Ô]00.000.000/0000-00[Ô])
[ô]enviar dados para impressão da etiquela Descrição, Barcode, Valor
[ô]i = prn.ImpressoraItem(txtDsc.Text, txtBarCode.Text, CDbl(txtValor.Text))
i = prn.ImpressoraItem(txtDsc.Text, txtBarCode.Text, CDbl(format(txtValor.Text, [Ô]#,##0.00[Ô])))

End If

End Sub
Página 1 de 2 [14 registro(s)]
Tópico encerrado , respostas não são mais permitidas