Page 3 of 4

PostPosted: Thu Nov 06, 2008 12:11 pm
by Adolfo
Holas

Pueden descargarlo de aqui.

http://200.72.140.34/privado/

Desde Chile
Adolfo[/url]

PostPosted: Fri Nov 07, 2008 3:06 pm
by anserkk
Any body tried the code. Any other enhancements. ?

Any idea how to check network dot matrix printer status offline online ?

Regards

Anser

PostPosted: Mon Nov 10, 2008 9:14 am
by anserkk
Estimado Ralph,

¿Qué piensa de la idea de utilizar PrintFileRaw (), mientras que las páginas de impresión, de manera que seamos capaces de utilizar múltiples formatos de impresión en una sola línea (como los comandos de impresora en negrita, cursiva, etc Doble Strike en modo DOS)

Saludos

Anser

PostPosted: Mon Nov 10, 2008 12:40 pm
by jbrita
Y COMO IMPRIMO DIRECTOR POR USB PERO SIN VISUALIZAR

GRACIAS

Re: TdosPrn con Preview e impresoras laser

PostPosted: Sat Jan 17, 2009 3:06 pm
by faraon
Pueden volver a subirlo por favor???

Re: TdosPrn con Preview e impresoras laser

PostPosted: Thu Jan 22, 2009 7:50 am
by anserkk
faraon wrote:Pueden volver a subirlo por favor???


http://rapidshare.com/files/187515980/A ... ersion.zip

Anser

Re: TdosPrn con Preview e impresoras laser

PostPosted: Fri Jan 23, 2009 3:00 am
by faraon
Muchas gracias anserkk...

Re: TdosPrn con Preview e impresoras laser

PostPosted: Sat Apr 14, 2012 4:31 am
by artu01
anserkk / ralph / adolfo:
podrian volver a subir el archivo
Estoy interesado en usar esta clase para imprimir en puerto lpt1 / usb / impresora remota

Gracias

Re: TdosPrn con Preview e impresoras laser

PostPosted: Sat Apr 14, 2012 2:02 pm
by ralph
Pueden descargar desde aqui: http://www.solupymes.com/fwin/tdosprevn.zip

Re: TdosPrn con Preview e impresoras laser

PostPosted: Sat Apr 14, 2012 6:08 pm
by artu01
Gracias, Ralph
hare pruebas y te cuento

Re: TdosPrn con Preview e impresoras laser

PostPosted: Mon May 14, 2012 5:12 pm
by ltorres
anserkk wrote:
faraon wrote:Pueden volver a subirlo por favor???


http://rapidshare.com/files/187515980/A ... ersion.zip

Anser



Anser

Buenos días, podrías enviarme tu clase modificada ?, mi correo es ltorreslm@hotmail.com.


Gracias

Re: TdosPrn con Preview e impresoras laser

PostPosted: Tue May 15, 2012 5:53 am
by anserkk

Re: TdosPrn con Preview e impresoras laser

PostPosted: Fri May 18, 2012 3:32 am
by ltorres



MUCHAS GRACIAS !!!!!!!!

Re: TdosPrn con Preview e impresoras laser

PostPosted: Tue May 22, 2012 7:11 pm
by artu01
ANSER
i dont get to print over printer with USB port
It creates only files in memory but dont print
Here this my code

Code: Select all  Expand view

#include "FiveWin.ch"
#include "report.ch"
#define  HKEY_LOCAL_MACHINE      2147483650

Function Atest()

      @ 2, 12 BUTTON oBtn2 PROMPT "&Texto" OF oDlg SIZE 40,12 ;
              ACTION TestRep( .t., oDlg)

      ACTIVATE DIALOG oDlg CENTERED

RETURN NIL

/--------------------------------------------------------------------------

static function TestRep( lModal, oDlg)

   local oPrn, cTitulo
   local nLin, nLinMax, nPag, cTmp, nItens

   SET _3DLOOK ON

   SetMTxtPreview( .f., 5, 2, .f., .t. )

   cTitulo:= "**** TEST DE TTXTPREVIEW ****"

   USE TEST2

   GO TOP

   nLin    := 1
   nPag    := 0
   nItens  := nTotal := 0

   oPrn:= TDosPrn():New(.t.)  // .T. bota error de variable no existe HKEY_LOCAL_MACHINE

   if ! oPrn:lCancel
      begin sequence

         oPrn:StartPage()

         do while !Eof()

            //--- Cabecalho
            //
            if nLin = 1

               nPag++

               oPrn:Command( oPrn:cNormal )
               oPrn:Say( nLin, 00, PadC( cTitulo, 79 ) )
               oPrn:Command( oPrn:cCompress )

               ++nLin
               oPrn:Say( ++nLin, 01, "LISTA DE FUNCIONARIOS" )

               oPrn:Say( nLin, 124, "Pag.: " + StrZero( nPag,3 ) )      // Pagina
               //oPrn:Say( ++nLin, 001, Repl("-", 160) )
               oPrn:Say( ++nLin, 001, Repl("-", 130) )
               oPrn:Say( ++nLin, 001, "NOMBRE                                    DIRECCION                       CIUDAD                 ESTADO   CEP                SALARIO" )
               oPrn:Say( ++nLin, 001, Repl("-", 130) )

            endif

            //--- Corpo do relatorio
            //
            nlin+=1
            oPrn:Say(   nLin, 001, Alltrim( first ) + " " + Alltrim( last ) )
            oPrn:Say(   nLin, 043, street )
            oPrn:Say(   nLin, 075, left( city, 20) )
            oPrn:Say(   nLin, 098, state )
            oPrn:Say(   nLin, 107, zip )
            oPrn:Say(   nLin, 119, Transform( salary, "@R 999,999,999.99" ) )
            **oPrn:Say(   nLin, 135, notes )

            skip
            nItens++
            nTotal+= salary

            if nLin+1 > oPrn:nMaxLine                          // se passou a linha max
               oPrn:Say( ++nLin, 001, Repl("-", 160) )
               nLin:= 1                                        //  volta contador para 1
            endif                                              //  nova pagina

         enddo

         oPrn:Say( ++nLin, 001, Repl("-", 160) )
         oPrn:Say( ++nLin, 001, "Total de Funcionarios : " + Alltrim( Tran( nItens,"999,999" ) ) )
         oPrn:Say(   nLin, 119, Transform( nTotal, "@R 999,999,999.99" ) )

         oPrn:EndPage()                                        // salta pagina
         oPrn:End()

      end sequence

      close TEST2

      //--- Passar a Dialog como ultimo parametro.
      //
      if oPrn:lPreview
         TxtPreview( oPrn:cDevice, cTitulo, lModal,,, oPrn, oDlg, , oPrn:lModoGraf )
      endif
   endif
return nil

*------------------------------------------*
Function ActivePrnType()
*------------------------------------------*
// Function created by Anser
// This function will check whether the current/active/selected printer is
// Dot Matrix or InkJet/Laser
// Return Value .T. = Dot MAtrix
// Return Value .F. = Inkjet or Laser
Local oPrn
PRINT oPrn NAME "Test"
    if Empty( oPrn:hDC )
        MsgStop("No printers Installed")
        Return .F.          // Printer is not installed or ready
    endif

    IF oPrn:nLogPixelX() <= 350  // Dot Matrix Printer ie Text Printer
        ENDPRINT
        Return .T.
    else  // Injet or Laser ie Grpahics Printer
        ENDPRINT
        Return .F.
    Endif
ENDPRINT
Return .F.


*----------------------------------------*
FUNCTION IsNetworkPrn(cPrnName)
*----------------------------------------*
* Function created by Anser
* This function will determine whether the Printer is a Network Printer(DOT Matrix)
* cPrnName is the Name of the Printer For Eg.PrnGetName()-> \\Abhi\Epson LQ-2080 ESC/2 P
Local cPrnPcName:=""
Local aPrnSrvrs:={},nPos:=0

aPrnSrvrs:=oWinGetSerP() // Gives NetBios name of PrintServers availabe to the user
cPrnName:=Ltrim(Rtrim(cPrnName))
if left(cPrnName,2) == "\\"
    cPrnName:=Right(cPrnName,len(cPrnName)-2)  // Remove the \\ from the Printer name found at the begining of the Prn name
    cPrnPcName:=LEFT(cPrnName, AT("\",cPrnName) -1) // Pick only the PCName  ie Abhi from the string "Abhi\Epson LQ-2080"
else
    Return .F.
Endif
nPos:=aScan(aPrnSrvrs,cPrnPcName)
if nPos > 0
    Return .T.
Else
    Return .F.
Endif

*----------------------------------------------*
FUNCTION PrnPortUrl(cPrnName)
*----------------------------------------------*
* Fuction created by Anser
* Returns a string \\NetBiosName_Of_The_Pc_Where_The_Printer_IsPhysically_Installed\Printer_ShareName
* Expected value in Parameter cPrnName is the Printer Name For Eg.PrnGetName()-> "
\\Abhi\Epson LQ-2080 ESC/2 P"
* Uses Registry to find out the values

LOCAL cRealPrnName:="
", cPcName :="" , cPrnShareName:="" , cRegPath:=""
LOCAL oReg

if empty(cPrnName)
    MsgStop("
Printer Name is empty. Unable to proceed further")
    Return "
"
Endif

cPrnName:=Ltrim(Rtrim(cPrnName))
if left(cPrnName,2) == "
\\"   // Network Dot Matrix Printer name will have \\ in the beginning of the Printer Name
    cPrnName:=Right(cPrnName,len(cPrnName)-2) // Remove the \\ from the Printer name found at the begining of the Prn name
    cPcName:=LEFT(cPrnName, AT("
\",cPrnName) -1) // Pick the PCName  ie Abhi from the string "Abhi\Epson LQ-2080"
    cRealPrnName:=RIGHT(cPrnName, Len(cPrnName)-AT("
\",cPrnName) )  // Picking the Printer name after avoiding the "\\Abhi\" from the string
Endif

// Path in the registry for Windows 2000 and above
cRegPath:="
SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers\"+cPcName+"\Printers\"+cRealPrnName+"\DsSpooler"
oReg := TReg32():New(HKEY_LOCAL_MACHINE,cRegPath )
IF oReg:nError = 0
    cPcName := oReg:Get("
shortServerName", "")
    cPrnShareName := oReg:Get("
printShareName", "")
else
    MsgInfo("
Unable to locate NetBiosName of the PC where the Printer is physically installed"+CRLF+;
            "
Unable to locate the Printer's ShareName")
    Return ""
ENDIF
oReg:Close()
oReg := NIL
RETURN "\\"+cPcName+"\"+cPrnShareName

*******************
FUNCTION oWinGetSerP()
*******************
* Returns the names of print servers available for the current post
* Author Badara Thiam

LOCAL nHandle
LOCAL cValue
LOCAL n1
LOCAL n2
LOCAL cSubkeys
LOCAL aHKey := HKEY_LOCAL_MACHINE
LOCAL TSERVEURS := {}

cSubKeys := "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\LanMan Print Services\Servers"
IF RegOpenKey( aHKey,  cSubKeys,  @nHandle ) == 0

    * Recherche des serveurs accessibles
    n1 := 0
    TSERVEURS := {}
    DO WHILE .T.
      cValue := ""
      n2 := RegEnumKey( nHandle, n1,  @cvalue  )
      SysRefresh()
      IF n2 = 0
        AADD(TSERVEURS, cValue)
      ELSE
        EXIT
      ENDIF
      n1 ++
    ENDDO

    RegCloseKey( nHandle )
ENDIF
RETURN ACLONE(TSERVEURS)


you can try my code with your program and tell me if you get to print over usb printer

i hope that you can help me
thanks

Re: TdosPrn con Preview e impresoras laser

PostPosted: Wed May 23, 2012 5:57 am
by anserkk
artu01 wrote:you can try my code with your program and tell me if you get to print over usb printer
i hope that you can help me


Your code is working fine for me. I was able to preview and then print to a network Laser printer.

Anyway, I am herewith giving you the download link of the prg, make file, exe etc.

https://rapidshare.com/files/1904692306/Atur.zip

Regards
Anser