Eu vi seu código. Vc precisa jogar(direcionar) a saida para um arquivo texto, neste caso.
Essas duas funções uma liga a impressão em arquivo, a outra desliga.
Vc imprime da mesma forma que eu aqui, usando ? e ??
Código: Selecionar todos
*******************************
Function CriaArqImpressao(cArq)
*******************************
*
*
if pcount() = 0
cArq := "etiquetas.txt"
endif
IF hb_vfExists(cArq)
DO WHILE !Empty(hb_vfErase(cArq))
alert("Falha apagando o arquivo: "+cArq)
ENDDO
ENDIF
set printer to &cArq
set print on
set console off
set Printer on
Return cArq
*********************
Function FecharImpres
*********************
*
*
set margin to 0
set print off
set printer to
set console on
set Printer off
return .t.
Código: Selecionar todos
**********************************
Function Imprime(cArq,cPrint,cTit)
**********************************
*
*
Local oPrn, aPrn:=WIN_PRINTERLIST()
hb_default(@cPrint,win_PrinterGetDefault())
hb_default(@cTit,"PEDIDO")
If Empty(cArq)
alert('Informe algo p/ imprimir.')
Return .F.
EndIf
If empty(aPrn)
alert('Não há impressoras instaladas')
Return .F.
EndIf
//alert( "win_printerStatus(): " + hb_ntos( win_printerStatus(cPrint) ) )
nRet := Win_PrintFileRaw(cPrint,cArq,cTit)
if nRet < 1
cMsg := 'Erro Imprimindo: '
SWITCH nRet
CASE -1
cMsg += "Parâmetro inválido passado" ; EXIT
CASE -2
cMsg += "WinAPI OpenPrinter() Falha na chamada" ; EXIT
CASE -3
cMsg += "WinAPI StartDocPrinter() Falha na chamada" ; EXIT
CASE -4
cMsg += "WinAPI StartPagePrinter() Falha na chamada" ; EXIT
CASE -5
cMsg += "WinAPI malloc() of memory failed" ; EXIT
CASE -6
cMsg += "Arquivo " + cArq + " não Localizado" ; EXIT
//DEFAULT
// cMsg += cFile + " PRINTED OK!!!"
END
alert(cMsg)
EndIf
Return .T.
Saudações,
Itamar M. Lins Jr.


