Estou precisando imprimir uma sequencia de 8 numeros e o seu respectivo código de barras ao lado, usando o WIN32PRN().
Estou usando o Harbour e gerando o .exe com HBMK2.
Abaixo o código:
Código: Selecionar todos
#include "inkey.ch"
#include "setcurs.ch"
#include "ETIQ.ch"
Func MAIN()
Local cPrinter, nNumPed:= nRoma:= 0
Clear Screen
@ 06, 04 Say "Romaneio " Get nRoma Picture "99999"
@ 08, 04 Say "Ficha " Get nNumPed Picture "99999999"
Read
aPrn:= GetPrinters()
@ 04, 04 Clear To 20, 70
@ 04, 04 To 20, 70
IF EMPTY(aPrn)
@ 10, 10 Say "Nao tem impressoras instaladas - Nao posso continuar "
QUIT
ENDIF
cPrinter := GetDefaultPrinter()
PrinterFicha(nRoma,nNumPed,cPrinter,Date())
Return
*********************************************************************
#define FORM_A4 9
#define RGB( nR,nG,nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) )
#define PS_SOLID 0
FUNC PrinterFicha(nRoma,nNumPed,cPrinter,dDatRom)
LOCAL oPrinter:= WIN32PRN():New(cPrinter), aFonts, x, nColFixed, nColTTF
LOCAL nColCharSet, aForms, nVez:= nLinEt:= nA:= 0
LOCAL cLinha:= ""
oPrinter:Landscape:= .F.
oPrinter:FormType := FORM_A4
oPrinter:Copies := 1
oPrinter:SetFont('courier new',20,{3,18}, 700,.F.,.F.)
oPrinter:SetPrc(oPrinter:prow(),02)
IF !oPrinter:Create()
Alert("Cannot Create Printer")
ELSE
IF !oPrinter:startDoc("Etiqueta")
@ 10,06 Say "IMPRESSORA NAO ESTA PRONTA "
Return
ELSE
cLinha:= Space(5) + " roman. " + Str(nRoma,5) + " " + DToC(dDatRom)
oPrinter:LineHeight:= 45
oPrinter:SetFont('courier new',12,{1,8}, 0,.F.,.F.)
oPrinter:SetPrc(oPrinter:prow()+1,00)
oPrinter:TextOut(cLinha,.T.)
oPrinter:LineHeight:= 45
oPrinter:SetFont('courier new',12,{1,8}, 0,.F.,.F.)
oPrinter:SetPrc(oPrinter:prow()+1,00)
oPrinter:TextOut(" ",.T.)
cLinha:= Space(5) + Str(nNumPed,8)
oPrinter:LineHeight:= 150
oPrinter:SetFont('courier new',30,{2,18}, 0,.F.,.F.)
oPrinter:SetPrc(oPrinter:prow()+1,00)
oPrinter:TextOut(cLinha,.T.)
** aqui eu gostaria de imprimir o codigo de barras de nNumPed
oPrinter:EndDoc()
ENDIF
oPrinter:Destroy()
ENDIF
Return
*********************************************************************
Eu estive olhando no forum, alguem já postou que usa o win32prn para isso, mas eu não consegui um exemplo para aprender.
Fico no aguardo.
Obrigado por enquanto.
Rosalvo

