Eu tenho um utilitário de impressão para esse modelo da bematech é só adaptar a função abaixo:
Este exemplo foi feito em MiniGui então algumas funções são da minigui como por exemplo msgtop, substituir para a que costuma usar
FUNCTION PrintWin( cPrinter, cArq )
LOCAL oPrn:=Nil, aPrn:=Win_PrinterList( .T., .F. ), __nColFixed, cLinha, oElemento, lImp:=.F.
cPrinter := hb_DefaultValue( cPrinter, Win_PrinterGetDefault() )
cArq := hb_DefaultValue( cArq, "" )
IF Empty( cArq )
MsgStop( "Arquivo de impressão deve ser informado", "Erro" )
RETURN .F.
ENDIF
IF Empty( aPrn )
MsgStop( "Não há impressoras instaladas", "Erro" )
RETURN .F.
ENDIF
FOR EACH oElemento IN aPrn
IF Upper( oElemento[1] ) = Upper( cPrinter )
//oElemento[1] //Nome da impressora
//oElemento[2] //Porta onde a impressora está ligada
lImp:=.T.
ENDIF
NEXT
IF ! lImp
MsgStop( "Impressora " + cPrinter + " não está instalada." + hb_Eol() + "Entre em contato com o helpdesk", "Erro" )
RETURN Nil
ENDIF
oPrn := Win_Prn():New( cPrinter )
oPrn:FormType := WIN_DMPAPER_USER
oPrn:PaperWidth := 3*26.4*10
oPrn:Copies := 1
IF ! oPrn:Create()
MsgStop( "Não foi criado documento.", "Erro de Impressão" )
oPrn:Destroy()
RETURN Nil
ENDIF
IF ! oPrn:StartDoc( "DocPrint" )
MsgStop( "Erro na Impressora.", "Erro de Impressão" )
oPrn:Destroy()
RETURN Nil
ENDIF
oPrn:SetFont( "Lucida Console", 8, 0 )
__nColFixed := 0
PrintCabec( .T., oPrn, hb_DirBase() + "fazenda.bmp" )
FT_FUSE( cArq )
DO WHILE ! FT_FEOF()
cLinha := FT_FREADLN()
cLinha := IF( Empty( cLinha ), " ", cLinha )
oPrn:SetPos( __nColFixed )
oPrn:Textout( cLinha, .T. )
FT_FSKIP()
ENDDO
FT_FUSE()
PrintCabec()
oPrn:EndDoc()
oPrn:Destroy()
oPrn:=Nil
RETURN .T.
FUNCTION PrintCabec( lInicio, oPrn, cBitFile )
LOCAL __nLinha := 50, __nColuna := 100, __nHandleFile, _i, I
STATIC __oBMP
STATIC __nWidth
STATIC __nHeight
lInicio := hb_DefaultValue( lInicio, .F. )
cBitFile := hb_DefaultValue( cBitFile, "" )
IF lInicio
IF ! Empty( cBitFile ) .AND. __oBMP = Nil
fi_Initialise()
__nHandleFile := fi_Load( FIF_BMP, cBitFile, BMP_DEFAULT )
__nWidth := fi_GetWidth( __nHandleFile )
__nHeight := fi_GetHeight( __nHandleFile )
fi_DeInitialise()
ENDIF
oPrn:SetPrc( 0, 0 ) // 1, 0
oPrn:SetPrc( oPrn:pRow(), 4 )
FOR I:=1 TO 10
oPrn:Textout( " ", .T. )
NEXT
IF ! Empty( cBitFile )
IF hb_vfExists( cBitFile )
IF __oBMP = Nil
__oBMP := Win_BMP():New()
IF !__oBMP:loadFile( cBitFile )
RETURN Nil
ENDIF
//oBmp:Draw( oPrn, { nColuna, nLinha, nWidth, nHeight } )
/* Note: Can also use this method to print bitmap */
//__oBmp:Rect := { __nColuna, __nLinha, __nWidth, __nHeight }
//oPrn:DrawBitmap( __oBmp )
ENDIF
__oBMP:Draw( oPrn, { __nColuna, __nLinha, __nWidth, __nHeight } )
ENDIF
ENDIF
ELSE
IF __oBMP != Nil
__oBMP:Destroy()
__nWidth := Nil
__nHeight := Nil
__oBMP := Nil
ENDIF
ENDIF
RETURN Nil