Daniel Halon Posted December 2, 2022 Report Share Posted December 2, 2022 Amigos, mais uma vez preciso de uma ajuda, tenho uma impressora Epson TM T20X, já salvei o logo na memoria, porem não consigo acertar os comandos para imprimir no pedido. Alguem já passou por isto? LogoSanta.bmp Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 2, 2022 Report Share Posted December 2, 2022 https://imgur.com/vPpUqIi #Include "FiveWin.ch" // ************************************************************* // * Impresion del recibo de pagos FUNCTION Recibo() LOCAL oFont, oFont1, oPrn, nRow LOCAL cNombre := "JOSE ALVAREZ COMPANY " LOCAL nCuit := 10.000 PRINT oPrn NAME "Recibo" PREVIEW MODAL DEFINE FONT oFont NAME "ARIAL" SIZE 0, -14 BOLD OF oPrn DEFINE FONT oFont1 NAME "CALIBRI" SIZE 0, -16 BOLD OF oPrn oPrn:SetPage( 9 ) //-> A4 //9 oPrn:SetPortrait() //-> Vertical(Retrato) PAGE // * Con nRow puedes ir imprimiendo debajo de lo ultimo que imprimiste @ 2, 1 PRINT TO oPrn TEXT "Nombre de la Empresa" SIZE 9, 1 CM FONT oFont1 ALIGN "C" LASTROW nRow // * 2, 1 es en 2 cm de margen superior y 1 cm del margen izquierdo // * SIZE 9,1 Quiere decir que el texto lo tiene que mostrar en 9 cms de ancho por 1 de alto // * ALING "C" te alinea el texto CENTRALIZADO (L: Left, R: Right) en los 9 cms que vos le indicaste // * Siempre con el tamaño del font que estes utilizando, eso es lo bueno... @ nRow, 01 PRINT TO oPrn TEXT "Domicilio Comercial:" SIZE 9, 1 CM FONT oFont LASTROW nRow ALIGN "C" @ nRow, 01 PRINT TO oPrn TEXT "Condicion de IVA" SIZE 9, 1 CM FONT oFont LASTROW nRow ALIGN "C" @ 5.5, 1 PRINT TO oPrn TEXT "C.U.I.T.:" SIZE 3, .5 CM FONT oFont1 ALIGN "R" // @ 5.5, 4.1 PRINT TO oPrn TEXT oQryPag:cuit SIZE 6, .5 CM FONT oFont ALIGN "L" @ 5.5, 4.1 PRINT TO oPrn TEXT nCuit SIZE 6, .5 CM FONT oFont ALIGN "L" @ 5.5, 7.5 PRINT TO oPrn TEXT "Razon Social:" SIZE 4.5, 1 CM FONT oFont1 ALIGN "R" // @ 5.5, 12.5 PRINT TO oPrn TEXT AllTrim( oQryPag:nombre ) SIZE 8, 1 CM FONT oFont LASTROW nRow ALIGN "L" @ 5.5, 12.5 PRINT TO oPrn TEXT AllTrim( cNombre ) SIZE 8, 1 CM FONT oFont LASTROW nRow ALIGN "L" @ 7.5, 2.5 PRINT TO oPrn TEXT "Daniel: Salve de .BMP a .JPG a Imagem." SIZE 14.5, 1 CM FONT oFont1 ALIGN "R" // * Etc. Etc. // * Tambien puedes poner imagenes @ 0.5, .5 PRINT TO oPrn IMAGE "LogoSanta.jpg" SIZE 06, 1 CM ENDPAGE ENDPRINT oFont:End() oFont1:End() RETURN NIL Regards, saludos. Quote Link to comment Share on other sites More sharing options...
Daniel Halon Posted December 2, 2022 Author Report Share Posted December 2, 2022 Bom dia Kapi, Voy a postar una parte de la impresión , teniendo en cuenta que es una impressora térmica de 40 columnas. Toda la impresión de textos esta ok, solo no consigo que salga impreso el logotipo Function Imprime_Epson_TM20X( p_pedido, p_rei) PRIVATE a_zzinfo := {}, m_dest PRIVATE oPrin, oPrn, cTitulo PRIVATE dData_ini := ctod( '01/' + alltrim( str( month( tele0050->a_dtmov_50 ) ) ) + '/' + alltrim( str( year( tele0050->a_dtmov_50 ) ) ) ) PRIVATE m_desc := '' PRIVATE m_tam := '' PRIVATE nTotal := 0 PRIVATE cString := '' PRIVATE cFone PRIVATE mCont PRIVATE cTelefonos PRIVATE cDomicilio := Space(40) PRIVATE cSite := Space(40) PRIVATE cCidade := Space(30) PRIVATE cFile PRIVATE nLin PRIVATE cPorta PRIVATE aInfo := {} ************************************************************************************************* Logo := CHR(29)+CHR(40)+CHR(76)+CHR(06)+CHR(00)+CHR(48)+CHR(69)+CHR(48)+CHR(48)+CHR(01)+CHR(01) * *Comando para impressão do logo na ELGIN I9, não funciona na Epson TM T20x * ************************************************************************************************* *exemplo do Kapi *cFile := cFilePath( GetModuleFileName( GetInstance() ) ) + Strzero(p_pedido,6,0) + ".TXT" *? cFile *WinExec( "Notepad.exe " + cFile ) *Diversas formas de direccionar a impressao *cPorta := TELE0050->A_DISP1_50 *cPorta := GetDefaultPrinter() *cPorta := '\\gerencia\pedidos' cPorta := ALLTRIM(NEWPAR->PORTA) cFile := Strzero(p_pedido,6,0) + IF (NEWPAR->HAB_IMPRE == .T.,'.PRN', '.TXT') *cFile := cFile + IF (NEWPAR->HAB_IMPRE == .T.,'.PRN', '.TXT') nLin := 0 NEWCLI->( dbsetorder( 1 ) ) NEWPRO->( dbsetorder( 1 ) ) Tele0060->( dbsetorder( 1 ) ) Tele0070->( dbsetorder( 5 ) ) tele0060->(dbseek(p_pedido)) cFone := Tele0060->( a_cli___60 ) NEWCLI->( dbseek( cFone ) ) Tele0070->( dbseek(p_pedido) ) IF TELE0070->(!FOUND()) Msginfo('nao achei os produtos, FW34-linha-165') ENDIF //////////////////////// // aInfo // // 1 - numero pedido // // 2 - data // // 3 - valor // //////////////////////// *cTitulo := '*' + ALLTRIM(tele0060->a_casa__60) + '*' *Telefones das empresas, ate 4 fones cTelefonos := NEWPAR->FONE1 + IIF(ALLTRIM(NEWPAR->FONE2) # '-','/' + 'Whatts: ' + NEWPAR->FONE2,'') +; IIF(ALLTRIM(NEWPAR->FONE3) # '-','/' + NEWPAR->FONE3,'') +; IIF(ALLTRIM(NEWPAR->FONE4) # '-','/' + NEWPAR->FONE4,'') cDomicilio := ALLTRIM(NEWPAR->ENDERECO1) cCidade := ALLTRIM(NEWPAR->CIDADE) + ' - ' + ALLTRIM(NEWPAR->ESTADO) cSite := ALLTRIM(NEWPAR->SITE1) *oPrin := XDosPrn():New(IIF(NEWPAR->HAB_IMPRE == .F., cPorta, cFile) ) Imprime_pedido(p_Pedido) Return /////////////////////////////////////////////////////////////////////////////////////////////// Function Imprime_pedido(p_pedido) LOCAL cTitulo := ALLTRIM(NEWPAR->EMPRESA1) If NEWPAR->HAB_IMPRE == .F. MsgInfo('A impressao nao esta Habilitada nos parametros,' + CRLF + ' Visualizarei o pedido para Voce') Mostra_Comanda(p_Pedido) Return Endif *Gerando arquivo .prn para imprimir depois oPrin := XDosPrn():New(cFile) * Reset oprin:Startpage() oprin:command("27","64" ) IF NEWPAR->HAB_COMCLI == .T. //Se esta habilitada a comanda do Cliente *===Impressao do Logo no pedido===* IF NEWPAR->LOGO_PED == .T. *@ nLin, 00 PSay Centra(Logo,38) ELSE @ ++nLin, 00 PSay Enfatizado + Centra(cTitulo,40) + cEnfatizado *@ ++nLin, 00 PSay Enfatizado + Centra(cTitulo,20) + + FaceDuplaOff + LargoDuploOff ENDIF IF Tele0060->a_comple60 == .F. @ ++nLin, 00 PSay Enfatizado + Centra(cTelefonos,40) + NegritoOff @ ++nLin, 00 PSay Enfatizado + Centra(cDomicilio, 40) + NegritoOff @ ++nLin, 00 PSay Enfatizado + Centra(cCidade, 40) + cEnfatizado IF !Empty(cSite) @ ++nLin, 00 PSay Enfatizado +Centra(cSite, 40) + NegritoOff ENDIF IF !Empty(NEWPAR->FACEBOOK) @ ++nLin, 00 PSay Enfatizado +Centra(NEWPAR->FACEBOOK, 40) + cEnfatizado ENDIF IF !Empty(NEWPAR->INSTAGRAM) @ ++nLin, 00 PSay Enfatizado +Centra(NEWPAR->INSTAGRAM, 40) + NegritoOff ENDIF @ ++nLin, 00 PSay Normal + Enfatizado + REPLICATE ('-',42) + NegritoOff ELSE *@ ++nLin, 00 PSay Enfatizado + Centra(cTitulo, 24) + FaceDuplaOff + LargoDuploOff @ ++nLin, 00 PSay Normal + Enfatizado + Centra('*COMPLEMENTO*', 40 ) + cEnfatizado ENDIF @ ++nLin, 00 PSay pequena + Enfatizado + 'Data: ' + dtoc( Tele0060->a_dtped_60 ) + space( 1 ) +; 'Hora: ' + Tele0060->a_horae_60 + Space(12) + 'Ped.: ' + Normal + Enfatizado + Alltrim(strzero( p_pedido,6,0 )) @ ++nLin, 00 PSay Normal + Enfatizado + REPLICATE ('-',42) + NegritoOff //........................................................................... @ ++nLin, 00 PSay pequena + Enfatizado + substr( Tele0060->a_nome__60, 0, 42) @ ++nLin, 00 PSay tele0060->a_Prefix60 + space(1) + cFone + space(1) + 'Ramal' + space(1) + tele0060->a_ramal_60 + space(5) + 'Cel:' + Space(2) + tele0060->a_celula60 IF NEWPAR->HAB_IMPRE == .T. If MsgYesNo('Deseja imprimir o pedido', 'Atencao') PrintFileRaw( cPorta, cFile) * == FERASE(cFile) // a apartir de 04/08/21 os pedidos sao apagados no backup.bat apos zap nas bases en fw_fech.prg Endif ENDIF Quote Link to comment Share on other sites More sharing options...
Daniel Halon Posted December 2, 2022 Author Report Share Posted December 2, 2022 Opps, desculpem, postei em espanhol Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 2, 2022 Report Share Posted December 2, 2022 Daniel, que és : oPrin := XDosPrn():New(cFile) TDOSPRN.PRG? y donde está la llamada al archivo.jpg? ó .bmp? Mira en la TDOSPRN.PRG como se hace la llamada a un archivo.bmp ó .jpg si? No recuerdo como si hace usando TDOSPRN.PRG Gracias. Regards, saludos. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 2, 2022 Report Share Posted December 2, 2022 Daniel és totalmente posible hacer con la PRINTER.PRG, mira: http://forums.fivetechsupport.com/viewtopic.php?f=6&t=42427&sid=3bfb222ce4809ed3dd5509ea234429ea Regards, saludos. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 2, 2022 Report Share Posted December 2, 2022 Daniel, usando Win32Prn() intente ahi. // C:\XHBCC74\TESTS\TESTW32.PRG #define FORM_A4 9 #define PS_SOLID 0 #define RGB( nR,nG,nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) ) #define BLACK RGB( 0x0 ,0x0 ,0x0 ) #define BLUE RGB( 0x0 ,0x0 ,0x85 ) #define GREEN RGB( 0x0 ,0x85,0x0 ) #define CYAN RGB( 0x0 ,0x85,0x85 ) #define RED RGB( 0x85,0x0 ,0x0 ) #define MAGENTA RGB( 0x85,0x0 ,0x85 ) #define BROWN RGB( 0x85,0x85,0x0 ) #define WHITE RGB( 0xC6,0xC6,0xC6 ) FUNCTION Main() LOCAL nPrn:=1, cBMPFile:= SPACE( 40 ) LOCAL aPrn:= GetPrinters() LOCAL GetList:= {} CLS IF EMPTY(aPrn) Alert("No printers installed - Cannot continue") QUIT ENDIF DO WHILE !EMPTY(nPrn) CLS @ 0,0 SAY 'Win32Prn() Class test program. Choose a printer to test' @ 1,0 SAY 'Bitmap file name' GET cBMPFile PICT '@!K' READ @ 2,0 TO maxRow(),maxCol() nPrn:= ACHOICE(3,1,maxRow()-1,maxCol()-1,aPrn,.T.,,nPrn) IF !EMPTY(nPrn) PrnTest(aPrn[nPrn], cBMPFile) ENDIF ENDDO RETURN(NIL) STATIC FUNCTION PrnTest(cPrinter, cBMPFile) LOCAL oPrinter:= Win32Prn():New(cPrinter), aFonts, x, nColFixed, nColTTF, nColCharSet oPrinter:Landscape:= .F. oPrinter:FormType := FORM_A4 oPrinter:Copies := 1 IF !oPrinter:Create() Alert("Cannot Create Printer") ELSE IF !oPrinter:startDoc('Win32Prn(Doc name in Printer Properties)') Alert("StartDoc() failed") ELSE oPrinter:SetPen(PS_SOLID, 1, RED) oPrinter:Bold(800) oPrinter:TextOut(oPrinter:PrinterName+': MaxRow() = '+STR(oPrinter:MaxRow(),4)+' MaxCol() = '+STR(oPrinter:MaxCol(),4)) oPrinter:Bold(0) // Normal oPrinter:NewLine() oPrinter:TextOut(' Partial list of available fonts that are available for OEM_') oPrinter:NewLine() oPrinter:UnderLine(.T.) oPrinter:Italic(.T.) // oPrinter:SetFont('Courier New',7,{3,-50}) // Compressed print nColFixed:= 40 * oPrinter:CharWidth nColTTF := 48 * oPrinter:CharWidth nColCharSet := 60 * oPrinter:CharWidth oPrinter:TextOut('FontName') oPrinter:SetPos(nColFixed) oPrinter:TextOut('Fixed?') oPrinter:SetPos(nColTTF) oPrinter:TextOut('TrueType?') oPrinter:SetPos(nColCharset) oPrinter:TextOut('CharSet#',.T.) oPrinter:NewLine() oPrinter:Italic(.F.) oPrinter:UnderLine(.F.) aFonts:= oPrinter:GetFonts() oPrinter:NewLine() FOR x:= 1 TO LEN(aFonts) STEP 2 oPrinter:CharSet(aFonts[x,4]) IF oPrinter:SetFont(aFonts[x,1]) // Could use "IF oPrinter:SetFontOk" after call to oPrinter:SetFont() IF oPrinter:FontName == aFonts[x,1] // Make sure Windows didn't pick a different font oPrinter:TextOut(aFonts[x,1]) oPrinter:SetPos(nColFixed) oPrinter:TextOut(IIF(aFonts[x,2],'Yes','No')) oPrinter:SetPos(nColTTF) oPrinter:TextOut(IIF(aFonts[x,3],'Yes','No')) oPrinter:SetPos(nColCharSet) oPrinter:TextOut(STR(aFonts[x,4],5)) oPrinter:SetPos(oPrinter:LeftMargin, oPrinter:PosY + (oPrinter:CharHeight*2)) IF oPrinter:PRow() > oPrinter:MaxRow() - 10 // Could use "oPrinter:NewPage()" to start a new page EXIT ENDIF ENDIF ENDIF oPrinter:Line(0, oPrinter:PosY+5, 2000, oPrinter:PosY+5) NEXT x oPrinter:SetFont('Lucida Console',8,{3,-50}) // Alternative Compressed print oPrinter:CharSet(0) // Reset default charset oPrinter:Bold(800) oPrinter:NewLine() oPrinter:TextOut('This is on line'+STR(oPrinter:Prow(),4)+', Printed bold, ' ) oPrinter:TextOut(' finishing at Column: ') oPrinter:TextOut(STR(oPrinter:Pcol(),4)) oPrinter:SetPrc(oPrinter:Prow()+3, 0) oPrinter:Bold(0) oPrinter:TextOut("Notice: UNDERLINE only prints correctly if there is a blank line after",.T.) oPrinter:TextOut(" it. This is because of ::LineHeight and the next line",.T.) oPrinter:TextOut(" printing over top of the underline. To avoid this happening",.T.) oPrinter:TextOut(" you can to alter ::LineHeight or use a smaller font") oPrinter:NewLine() oPrinter:NewLine() oPrinter:SetFont('Lucida Console',18, 0) // Large print oPrinter:SetColor( GREEN ) oPrinter:TextOut("Finally some larger print") oPrinter:Box( 0, oPrinter:PosY+100, 100, oPrinter:PosY+200) oPrinter:Arc(200, oPrinter:PosY+100, 300, oPrinter:PosY+200) oPrinter:Ellipse(400, oPrinter:PosY+100, 500, oPrinter:PosY+200) oPrinter:FillRect(600, oPrinter:PosY+100, 700, oPrinter:PosY+200, RED) // To print a barcode; // Replace 'BCod39HN' with your own bar code font or any other font // oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(60 ), '1234567890', 'BCod39HN', 24, 0 ) // PrintBitMap( oPrinter, cBMPFile ) oPrinter:EndDoc() ENDIF oPrinter:Destroy() ENDIF RETURN(NIL) procedure PrintBitMap( oPrn, cBitFile ) LOCAL oBMP IF EMPTY( cBitFile ) * ELSEIF !FILE( cBitFile ) Alert( cBitFile + ' not found ' ) ELSE oBMP:= Win32BMP():new() IF oBmp:loadFile( cBitFile ) oBmp:Draw( oPrn, { 200,200, 2000, 1500 } ) // Note: Can also use this method to print bitmap // oBmp:Rect:= { 200,2000, 2000, 1500 } // oPrn:DrawBitMap( oBmp ) ENDIF oBMP:Destroy() ENDIF RETURN Regards, saludos. Quote Link to comment Share on other sites More sharing options...
Daniel Halon Posted December 6, 2022 Author Report Share Posted December 6, 2022 Boa noite Kapi, tal vez me expresé mal. Uso xDosPrn, es practicamente igual a TdosPrn, con algunas alteraciones hechas por Ramon Ortega en el año 1996. No tengo ningún problema con la impresión, lo que necesito es poder imprimir la logomarca que ya esta grabada en la ROM de la impresora Epson TM T20x, es solo saber los comandos ESC/POS para mandar a imprimir el logotipo. Por ejemplo: en otra pizzaria para la cual hice el sistema, usaban una impresora de 40 columnas Marca ELGIN I9, el comando en esta impresora para imprimir la logomarca es: CHR(29)+CHR(40)+CHR(76)+CHR(06)+CHR(00)+CHR(48)+CHR(69)+CHR(48)+CHR(48)+CHR(01)+CHR(01). Funciona perfectamente en la impresora ELGIN I9, pero en la EPSON no funciona. Preciso saber si alguien ya utilizó el comando ESC para imprimir el logo en la Epson TM T20x. Desde ya agradezco tu interés y la ayuda que siempre me diste. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted December 6, 2022 Report Share Posted December 6, 2022 (edited) Bom dia Daniel, sinceramente, não sei a resposta, melhor perguntar na EPSON qual é o comando, veja aqui por exemplo: https://www.projetoacbr.com.br/forum/topic/57546-como-carregar-logotipos-bitmaps-na-impressora-tm-t20x-através-da-ferramenta-utility/ https://epson.com.br/peps-drivers-apis-impressoras-nao-fiscais https://atendimento.facilsistemas.com.br/kb/article/172396/manual-inserir-logotipo-cupom-nfc-e https://atendimento.tecnospeed.com.br/hc/pt-br/articles/360012452493-Geral-Configurando-Impressora-EPSON-TM-T20-NFC-e https://epson.com.br/supportsearch?searchText=T20&support_keyword=T20 https://www.bztech.com.br/downloads/manual-epson-tm-t20x Regards, saludos. Edited December 6, 2022 by kapiaba Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 23, 2023 Report Share Posted June 23, 2023 Boma princesos(kkkk), alguém usa essa classes do [x]Harbour para imprimir? Dúvida: É possível imprimir usando @ SAY... LIN, COL como no CLIPPER? // C:\XHBCC74\TESTS\TESTW32P.PRG #define FORM_A4 9 #define PS_SOLID 0 #define RGB( nR,nG,nB ) ( nR + ( nG * 256 ) + ( nB * 256 * 256 ) ) #define BLACK RGB( 0x0 ,0x0 ,0x0 ) #define BLUE RGB( 0x0 ,0x0 ,0x85 ) #define GREEN RGB( 0x0 ,0x85,0x0 ) #define CYAN RGB( 0x0 ,0x85,0x85 ) #define RED RGB( 0x85,0x0 ,0x0 ) #define MAGENTA RGB( 0x85,0x0 ,0x85 ) #define BROWN RGB( 0x85,0x85,0x0 ) #define WHITE RGB( 0xC6,0xC6,0xC6 ) FUNCTION Main() LOCAL nPrn :=1, cBMPFile := SPACE( 40 ) LOCAL aPrn := GetPrinters() LOCAL GetList:= {} CLS IF EMPTY( aPrn ) // Nenhuma impressora instalada - NÆo ‚ poss¡vel continuar // Alert( "No printers installed - Cannot continue" ) Alert( "Nenhuma impressora instalada - NÆo ‚ poss¡vel continuar" ) QUIT ENDIF WHILE .NOT. EMPTY( nPrn ) CLS // Win32Prn() Programa de teste de classe. Escolha uma impressora para testar // @ 1,0 SAY 'Win32Prn() Class test program. Choose a printer to test' @ 1,0 SAY 'Win32Prn() Escolha uma impressora para testar' // @ 2,0 SAY 'Bitmap file name' GET cBMPFile PICT '@!K' // READ cBMPFile := "TESTE.BMP" // *.JPG NAO IMPRIME // @ 2, 0 TO maxRow(),maxCol() @ 4, 0 TO maxRow(),maxCol() @ 5, 2 SAY 'Impressora Disponiveis:' // 3, 1 nPrn := ACHOICE( 7, 2, maxRow()-1, maxCol()-1, aPrn, .T.,, nPrn ) IF .NOT. EMPTY( nPrn ) PrnTest( aPrn[nPrn], cBMPFile ) CLEAR SCREEN EXIT ENDIF ENDDO RETURN NIL STATIC FUNCTION PrnTest(cPrinter, cBMPFile) LOCAL oPrinter := Win32Prn():New(cPrinter), aFonts, x, nColFixed, nColTTF, ; nColCharSet oPrinter:Landscape:= .F. oPrinter:FormType := FORM_A4 oPrinter:Copies := 1 IF .NOT. oPrinter:Create() // NÆo ‚ Poss¡vel Criar Impressora // Alert( "Cannot Create Printer" ) Alert( "NÆo ‚ Poss¡vel Criar Impressora" ) ELSE // Win32Prn(Nome do documento nas Propriedades da impressora // IF .NOT. oPrinter:startDoc('Win32Prn(Doc name in Printer Properties)') IF .NOT. oPrinter:startDoc('Nome do documento nas Propriedades da impressora)') // Alert( "StartDoc() failed" ) Alert( "StartDoc() Falhou" ) ELSE oPrinter:SetPen( PS_SOLID, 1, RED ) oPrinter:Bold(800) FOR x:= 1 TO 8 // Pulos de Linhas oPrinter:NewLine() NEXT x oPrinter:TextOut( oPrinter:PrinterName+': MaxRow() = '+STR(oPrinter:MaxRow(),4)+' MaxCol() = '+STR(oPrinter:MaxCol(),4)) oPrinter:Bold(0) // Normal oPrinter:NewLine() oPrinter:TextOut(' Partial list of available fonts that are available for OEM_') oPrinter:NewLine() oPrinter:UnderLine(.T.) oPrinter:Italic(.T.) // oPrinter:SetFont('Courier New',7,{3,-50}) // Compressed print nColFixed:= 40 * oPrinter:CharWidth nColTTF := 48 * oPrinter:CharWidth nColCharSet := 60 * oPrinter:CharWidth oPrinter:TextOut('FontName') oPrinter:SetPos(nColFixed) oPrinter:TextOut('Fixed?') oPrinter:SetPos(nColTTF) oPrinter:TextOut('TrueType?') oPrinter:SetPos(nColCharset) oPrinter:TextOut('CharSet#',.T.) oPrinter:NewLine() oPrinter:Italic(.F.) oPrinter:UnderLine(.F.) aFonts:= oPrinter:GetFonts() oPrinter:NewLine() FOR x:= 1 TO LEN(aFonts) STEP 2 oPrinter:CharSet(aFonts[x,4]) IF oPrinter:SetFont(aFonts[x,1]) // Could use "IF oPrinter:SetFontOk" after call to oPrinter:SetFont() IF oPrinter:FontName == aFonts[x,1] // Make sure Windows didn't pick a different font oPrinter:TextOut(aFonts[x,1]) oPrinter:SetPos(nColFixed) oPrinter:TextOut(IIF(aFonts[x,2],'Yes','No')) oPrinter:SetPos(nColTTF) oPrinter:TextOut(IIF(aFonts[x,3],'Yes','No')) oPrinter:SetPos(nColCharSet) oPrinter:TextOut(STR(aFonts[x,4],5)) oPrinter:SetPos(oPrinter:LeftMargin, oPrinter:PosY + (oPrinter:CharHeight*2)) // Could use "oPrinter:NewPage()" to start a new page IF oPrinter:PRow() > oPrinter:MaxRow() - 10 EXIT ENDIF ENDIF ENDIF oPrinter:Line(0, oPrinter:PosY+5, 2000, oPrinter:PosY+5) NEXT x oPrinter:SetFont('Lucida Console',8,{3,-50}) // Alternative Compressed print oPrinter:CharSet(0) // Reset default charset oPrinter:Bold(800) oPrinter:NewLine() oPrinter:TextOut('This is on line'+STR(oPrinter:Prow(),4)+', Printed bold, ' ) oPrinter:TextOut(' finishing at Column: ') oPrinter:TextOut(STR(oPrinter:Pcol(),4)) oPrinter:SetPrc(oPrinter:Prow()+3, 0) oPrinter:Bold(0) oPrinter:TextOut("Notice: UNDERLINE only prints correctly if there is a blank line after",.T.) oPrinter:TextOut(" it. This is because of ::LineHeight and the next line",.T.) oPrinter:TextOut(" printing over top of the underline. To avoid this happening",.T.) oPrinter:TextOut(" you can to alter ::LineHeight or use a smaller font") oPrinter:NewLine() oPrinter:NewLine() oPrinter:SetFont('Lucida Console',18, 0) // Large print oPrinter:SetColor( GREEN ) oPrinter:TextOut("Finally some larger print") oPrinter:Box( 0, oPrinter:PosY+100, 100, oPrinter:PosY+200) oPrinter:Arc(200, oPrinter:PosY+100, 300, oPrinter:PosY+200) oPrinter:Ellipse(400, oPrinter:PosY+100, 500, oPrinter:PosY+200) oPrinter:FillRect(600, oPrinter:PosY+100, 700, oPrinter:PosY+200, RED) // To print a barcode; // Replace 'BCod39HN' with your own bar code font or any other font // oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ) , oPrinter:MM_TO_POSY(60 ), '1234567890', 'BCod39HN', 24, 0 ) PrintBitMap( oPrinter, cBMPFile ) // Pena: somente imprime .BMP oPrinter:EndDoc() ENDIF oPrinter:Destroy() ENDIF RETURN NIL PROCEDURE PrintBitMap( oPrn, cBitFile ) LOCAL oBMP IF EMPTY( cBitFile ) * ELSEIF .NOT. FILE( cBitFile ) Alert( cBitFile + ' not found ' ) ELSE oBMP:= Win32BMP():new() IF oBmp:loadFile( cBitFile ) // oBmp:Draw( oPrn, { 200,200, 2000, 1500 } ) // COL LIN LARG ALT E # DO FIVEWIN. oBmp:Draw( oPrn, { 200, 000, 0500, 500 } ) // Note: Can also use this method to print bitmap // oBmp:Rect:= { 200,2000, 2000, 1500 } // oPrn:DrawBitMap( oBmp ) ENDIF oBMP:Destroy() ENDIF RETURN NIL // FIN / END - kapiabafwh@gmail.com Regards, saludos. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.