TdosPrn con Preview e impresoras laser

User avatar
Adolfo
Posts: 815
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile
Contact:

Post by Adolfo »

Holas

Pueden descargarlo de aqui.

http://200.72.140.34/privado/

Desde Chile
Adolfo[/url]
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Lenovo Legion Y520, 16GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1050
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Post by anserkk »

Any body tried the code. Any other enhancements. ?

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

Regards

Anser
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Post by anserkk »

Estimado Ralph,

¿Qué piensa de la idea de utilizar PrintFileRaw (), mientras que las páginas de impresión, de manera que _ 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
jbrita
Posts: 425
Joined: Mon Jan 16, 2006 3:42 pm

Post by jbrita »

Y COMO IMPRIMO DIRECTOR POR USB PERO SIN VISUALIZAR

GRACIAS
faraon
Posts: 3
Joined: Fri Dec 26, 2008 4:21 pm

Re: TdosPrn con Preview e impresoras laser

Post by faraon »

Pueden volver a subirlo por favor???
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview e impresoras laser

Post by anserkk »

faraon wrote:Pueden volver a subirlo por favor???
http://rapidshare.com/files/187515980/A ... ersion.zip

Anser
faraon
Posts: 3
Joined: Fri Dec 26, 2008 4:21 pm

Re: TdosPrn con Preview e impresoras laser

Post by faraon »

Muchas gracias anserkk...
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview e impresoras laser

Post 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
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
User avatar
ralph
Posts: 63
Joined: Fri Nov 18, 2005 11:15 pm
Location: Lima - PERU

Re: TdosPrn con Preview e impresoras laser

Post by ralph »

Pueden descargar desde aqui: http://www.solupymes.com/fwin/tdosprevn.zip
Ralph del Castillo
Lima PERU
Fwh 17.09, xHb123_10193, MySQL 5.5, BCC 7.3
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview e impresoras laser

Post by artu01 »

Gracias, Ralph
hare pruebas y te cuento
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
ltorres
Posts: 42
Joined: Mon Jan 17, 2011 3:44 pm
Location: Lima - Peru

Re: TdosPrn con Preview e impresoras laser

Post 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
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview e impresoras laser

Post by anserkk »

ltorres
Posts: 42
Joined: Mon Jan 17, 2011 3:44 pm
Location: Lima - Peru

Re: TdosPrn con Preview e impresoras laser

Post by ltorres »


MUCHAS GRACIAS !!!!!!!!
artu01
Posts: 306
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview e impresoras laser

Post 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

#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
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: TdosPrn con Preview e impresoras laser

Post 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
Post Reply