Clase TDirectPrint

Re: Clase TDirectPrint

Postby Antonio Linares » Mon Feb 11, 2013 5:00 pm

Que ocurrió finalmente con ese trabajo de William ? Alguien tiene copia ? William, aún lo proporcionas ?

Me uno al comentario que en su dia hizo Rafa, pero por encima de todo esta el respetar las decisiones de cada uno, y agradecerle a William por esta y por tantas contribuciones tan valiosas que nos ha hecho a todos :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Clase TDirectPrint

Postby karinha » Wed Feb 13, 2013 11:43 am

Muy suave, William dijo que me iba a enviar una muestra. Esperando ansiosamente.

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Clase TDirectPrint

Postby wmormar » Mon Feb 18, 2013 2:30 pm

Antonio Linares wrote:Que ocurrió finalmente con ese trabajo de William ? Alguien tiene copia ? William, aún lo proporcionas ?

Me uno al comentario que en su dia hizo Rafa, pero por encima de todo esta el respetar las decisiones de cada uno, y agradecerle a William por esta y por tantas contribuciones tan valiosas que nos ha hecho a todos :-)


Antonio,

Hace una semana te he enviado correo, confirma de recibido por favor...
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: Clase TDirectPrint

Postby MGA » Tue Feb 19, 2013 11:03 am

Willian,

Por favor pode me enviar tambem: ubiratan@sgsistemas.com.br
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Clase TDirectPrint

Postby ruben Dario » Tue Feb 19, 2013 1:58 pm

Willian ,

Saludos

Me podrias proporcionar un ejemplo de como se usa esta libreria , ya que no veo documentacion.
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
ruben Dario
 
Posts: 1061
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Clase TDirectPrint

Postby Antonio Linares » Tue Feb 19, 2013 4:44 pm

William,

No la he recibido. Si me envias un zip, por favor renombralo como zop ó similar, gracias

Vendes el código de esta clase ? Alguna razón por la que no quieras compartir aqui su código ? gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Clase TDirectPrint

Postby Antonio Linares » Wed Feb 20, 2013 4:14 pm

Aqui esta la Clase TDirectPrint de William. Ha sido muy amable en proporcionarmela con la expresa autorización para publicarla. Gracias William! :-)

http://code.google.com/p/fivewin-contributions/downloads/detail?name=wtraw.prg&can=2&q=

wtraw.prg
Code: Select all  Expand view
/*
//
//  Fecha          : 22 de enero del 2010
//  Autor          : William Morales
//  Módulo         : Clase para imprimir documentos directos a la impresora de windows
//  Nombre         : wtraw.prg
//
*/


#include <fivewin.ch>

#xcommand @ <nRow>, <nCol> SAYDOS <Text> => ;
                           DevPos( <nRow>,<nCol>); DevOut(<Text>)

CLASS TDirectPrint
   DATA cIncos        AS CHARACTER       INIT "TDirectPrint v 0.1"
   DATA cBuild        AS CHARACTER       INIT "20100122"
   DATA cCredits      AS CHARACTER       INIT "Autor: William Morales" + CRLF + ;
                                              "wmormar@hotmail.com" + CRLF + CRLF + ;
                                              "Tester: " + CRLF + ;
                                              "   Willi Quintana" + CRLF + ;
                                              "   Oscar Chacon (costa rica)"
   DATA cMsg          AS CHARACTER       INIT ""
   DATA cFile         AS CHARACTER       INIT ""
   DATA cContent      AS CHARACTER       INIT ""
   DATA cPrinter      AS CHARACTER       INIT GetDefaultPrinter()
   DATA cDocument     AS CHARACTER       INIT "Imprimiendo documento : Powered by INCOS"
   DATA cLogo         AS CHARACTER       INIT ""

   DATA nRow          AS NUMERIC         INIT 0
   DATA nCol          AS NUMERIC         INIT 0
   DATA nCopy         AS NUMERIC         INIT 1
   DATA nHeight       AS NUMERIC         INIT 20
   DATA nWidth        AS NUMERIC         INIT 35

   DATA lDo           AS LOGICAL         INIT .f.

   METHOD new( cPrinter ) CONSTRUCTOR
   METHOD printerdefault()               INLINE ::cPrinter := GetDefaultPrinter()
   METHOD setlpt( nPort )
   METHOD jump( nJump )
   METHOD esc( cText )
   METHOD say( nRow, nCol, cText )
   METHOD opencash( cPrinter, nCash )
   METHOD sendtoprinter()
   METHOD checkport( nPort )             INLINE PrintReady( nPort )
   METHOD eject()                        INLINE ::esc( Chr(12) )

   METHOD beginprint()                   INLINE (::esc( Chr(27) + Chr(64) ), ;
                                                 ::esc( Chr(27) + Chr(120), Chr( 0 ) ) ;
                                                )
   METHOD endprint()                     INLINE (::esc( Chr(27) + Chr(18) ), ;
                                                 ::esc( Chr(27) + Chr(50) ), ;
                                                 ::esc( Chr(27) + Chr(72) ), ;
                                                 ::esc( Chr(27) + Chr(80) )  ;
                                                )
   METHOD bold( lOnOff )                 INLINE IF( lOnOff, ::esc( Chr(27) + Chr(71) ), ;
                                                            ::esc( Chr(27) + Chr(72) )  ;
                                                  )
   METHOD condensed()                    INLINE ::esc( Chr(27) + Chr(15) )
   METHOD normal()                       INLINE ::esc( Chr(27) + Chr(18) )
   METHOD expansive( lOnOff )            INLINE IF( lOnOff, ::esc( Chr(27) + Chr(14) ), ;
                                                            ::esc( Chr(27) + Chr(20) )  ;
                                                  )
   METHOD superscript( lOnOff )          INLINE IF( lOnOff, ::esc( Chr(27) + Chr(83) + Chr(48) ), ;
                                                            ::esc( Chr(27) + Chr(84) )  ;
                                                  )
   METHOD subscript( lOnOff )            INLINE IF( lOnOff, ::esc( Chr(27) + Chr(83) + Chr(49) ), ;
                                                            ::esc( Chr(27) + Chr(84) )  ;
                                                  )
   METHOD underline( lOnOff )            INLINE IF( lOnOff, ::esc( Chr(27) + Chr(45) + Chr(49) ), ;
                                                            ::esc( Chr(27) + Chr(45) + Chr(40) )  ;
                                                  )
   METHOD prnfile( cFile )
   METHOD logo( cFile, nHeight, nWidth ) INLINE (::cLogo := cFile, ::nHeight := nHeight, ;
                                                 ::nWidth := nWidth )
   METHOD printlogo()

ENDCLASS

/**************************************************************************************/
METHOD new( cPrinter )
   LOCAL nFile := 1

   DEFAULT cPrinter := GetDefaultPrinter()

   ::cPrinter := cPrinter
   ::lDo      := .t.
   ::cMsg     := ::cIncos + " - " + ::cBuild
   ::cContent := ""
   ::nCol     := 0
   ::nRow     := 0

   WHILE .t.
      ::cFile := "wmprn" + PadL( nFile++, 3, "0" ) + ".gcj"
      IF !File( ::cFile )
         EXIT
      ENDIF
      sysrefresh()
   ENDDO

   SET PRINTER TO (::cFile)
   SET DEVICE TO PRINT

   RETURN Self

/**************************************************************************************/
METHOD setlpt( nPort )
   LOCAL cPort := ""

   DEFAULT nPort := 1

   ::lDo := .t.
   cPort := PrinterPortToName( "LPT" + WCStr(nPort) + ":" )
   IF Empty( cPort )
      MSGINFO( "No hay impresora en el puerto seleccionado...", ::cMsg )
      ::lDo := .f.
      RETURN NIL
   ENDIF

   ::cPrinter := cPort

   RETURN NIL

/**************************************************************************************/
METHOD jump( nJump )
   LOCAL x := 0

   DEFAULT nJump := 1

   FOR x := 1 TO nJump
      @ ::nRow, 00 SAYDOS ""
      ::nRow += 1
   NEXT

   ::nCol := 00

   RETURN NIL

/**************************************************************************************/
METHOD esc( cText )
   @ ::nRow++, 00 SAYDOS cText
   ::nCol := Len(cText) + 1

   RETURN NIL

/**************************************************************************************/
METHOD say( nRow, nCol, cText )

   IF nRow < ::nRow
      nRow := ::nRow
   ENDIF

   IF nCol < ::nCol
      nCol := ::nCol
   ENDIF

   ::nRow := nRow
   ::nCol := nCol

   @ ::nRow++, ::nCol SAYDOS cText

   ::nCol := ::nCol + Len(cText) + 1

   RETURN NIL

/**************************************************************************************/
METHOD opencash( cPrinter, nCash )
   LOCAL cEscape    := ""
   DEFAULT cPrinter := "epson"
   DEFAULT nCash    := 0

   cEscape := Chr( 27 ) + Chr( 112 ) + WCStr( nCash ) + Chr(40) + Chr( 108 )
   IF Lower( cPrinter ) == "start"
      cEscape := Chr( 27 ) + Chr( 80 )
   ENDIF

   @ ::nRow++, 00 SAYDOS cEscape
   ::nCol := Len(cEscape) + 1

   RETURN NIL

/**************************************************************************************/
METHOD sendtoprinter( lDelete )
   LOCAL x     := 1
   LOCAL nRet  := 0
   LOCAL cMsg  := ""
   LOCAL lShow := .f.

   DEFAULT lDelete := .t.

   SET DEVICE TO SCREEN
   SET PRINTER TO

   IF ::nCopy < 1
      ::nCopy := 1
   ENDIF

   FOR x := 1 TO ::nCopy
      ::printlogo()

      nRet := PrintFileRaw( ::cPrinter, ::cFile, ::cDocument )

      cMsg += "Copy " + WCStr( x ) + CRLF

      IF nRet # 1
         lShow := .t.
      ENDIF

      SWITCH nRet
      CASE -1
         cMsg += "Invalid parameters passed to function" ; EXIT
      CASE -2
         cMsg += "WinAPI OpenPrinter() call failed"      ; EXIT
      CASE -3
         cMsg += "WinAPI StartDocPrinter() call failed"  ; EXIT
      CASE -4
         cMsg += "WinAPI StartPagePrinter() call failed" ; EXIT
      CASE -5
         cMsg += "WinAPI malloc() of memory failed"      ; EXIT
      CASE -6
         cMsg += "File " + ::cFile + " not found"        ; EXIT
      DEFAULT
         cMsg += "PRINTED OK!!!"
      END

      cMsg    += CRLF + CRLF

   NEXT

   IF lDelete
      FErase( ::cFile )
   ENDIF

   IF lShow
      MSGINFO( cMsg, ::cMsg )
   ENDIF

   RETURN NIL

/**************************************************************************************/
METHOD prnfile( cFile, lDeletepost )
   DEFAULT lDeletepost := .f.

   ::cFile := cFile
   ::sendtoprinter( lDeletepost )

   RETURN NIL

/**************************************************************************************/
METHOD printlogo()
   LOCAL cEmf := ""
   LOCAL oImg := NIL

   IF Empty( ::cLogo )
      RETURN NIL
   ENDIF

   IF !File( ::cLogo )
      MSGINFO( "Archivo logo no existe, verifique...", ::cMsg )
      RETURN NIL
   ENDIF

   //oImg := TImage()
   //oImg:LoadImage( , ::cLogo )
   //wgrabaemf( oImg:hDC, "wmlogo.xxx" )
   //PrintFileRaw( ::cPrinter, ::cLogo, ::cDocument )

   RETURN NIL

/**************************************************************************************/
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Clase TDirectPrint

Postby karinha » Wed Feb 20, 2013 4:20 pm

Gracias maestro y Willian,

Hay algún ejemplo para impresión en USB en una impresora de Ticket Matricial?

Gracias,
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Clase TDirectPrint

Postby Antonio Linares » Wed Feb 20, 2013 4:41 pm

Joao,

Eso es todo lo que me ha enviado William. Supongo que el tendrá ejemplos de uso :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Clase TDirectPrint

Postby acuellar » Wed Feb 20, 2013 4:45 pm

Antonio / William

Y la función WCStr()

Algún ejemplo de como utilizar la clase

Gracias.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Clase TDirectPrint

Postby Antonio Linares » Wed Feb 20, 2013 4:49 pm

Ya le he enviado un email a William, e imagino que el tambien verá esta conversación, para que nos proporcione algún ejemplo :-)

Y el codigo de esa función que falta, gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Clase TDirectPrint

Postby acuellar » Wed Feb 20, 2013 4:56 pm

Gracias Antonio.

Esperaré.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Clase TDirectPrint

Postby wmormar » Wed Feb 20, 2013 5:16 pm

Aqui está

Tomada de CSTR de xharbour

Code: Select all  Expand view
FUNCTION WCStr( xExp, nDecimals )

   LOCAL cType

   IF xExp == NIL
      RETURN 'NIL'
   ENDIF

   cType := ValType( xExp )

   SWITCH cType
      CASE 'C'
         RETURN xExp

      CASE 'D'
         RETURN dToS( xExp )

      CASE 'L'
         RETURN IIF( xExp, '.T.', '.F.' )

      CASE 'N'
         IF !HB_IsNil( nDecimals )
            RETURN AllTrim(Str( xExp, 11, nDecimals ))
         ELSE
            RETURN AllTrim(Str( xExp ))
         ENDIF

      CASE 'A'
         RETURN "{ Array of " +  LTrim( Str( Len( xExp ) ) ) + " Items }"

      CASE 'B'
         RETURN '{|| Block }'

      CASE 'O'
         RETURN "{ " + xExp:ClassName() + " Object }"

      CASE 'P'
         RETURN NumToHex( xExp )

      CASE 'H'
         RETURN "{ Hash of " +  LTrim( Str( Len( xExp ) ) ) + " Items }"

      DEFAULT
         RETURN "Type: " + cType
   END

RETURN ""
 
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: Clase TDirectPrint

Postby acuellar » Wed Feb 20, 2013 6:49 pm

Gracias William.

Se puede imprimir un archivo de texto que incluya logo?

Podrias dar algún ejemplo de como usarla.

Gracias.

Saludos,

Adhemar
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1593
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Clase TDirectPrint

Postby wmormar » Wed Feb 20, 2013 7:51 pm

acuellar,

Lo del logo quedo pendiente, no se ha terminado y pues solo fueron pruebas.

Lo del ejemplo de uso lo publicaré a la brevedad
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1073
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests