TdosPrn con Preview e impresoras laser

Postby Adolfo » Thu Nov 06, 2008 12:11 pm

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
----------
Asus TUF F15, 32GB Ram, 1 TB NVME M.2, 1 TB SSD, GTX 1650
User avatar
Adolfo
 
Posts: 846
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Postby anserkk » Fri Nov 07, 2008 3:06 pm

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: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Postby anserkk » Mon Nov 10, 2008 9:14 am

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

Postby jbrita » Mon Nov 10, 2008 12:40 pm

Y COMO IMPRIMO DIRECTOR POR USB PERO SIN VISUALIZAR

GRACIAS
jbrita
 
Posts: 487
Joined: Mon Jan 16, 2006 3:42 pm

Re: TdosPrn con Preview e impresoras laser

Postby faraon » Sat Jan 17, 2009 3:06 pm

Pueden volver a subirlo por favor???
faraon
 
Posts: 3
Joined: Fri Dec 26, 2008 4:21 pm

Re: TdosPrn con Preview e impresoras laser

Postby anserkk » Thu Jan 22, 2009 7:50 am

faraon wrote:Pueden volver a subirlo por favor???


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

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

Re: TdosPrn con Preview e impresoras laser

Postby faraon » Fri Jan 23, 2009 3:00 am

Muchas gracias anserkk...
faraon
 
Posts: 3
Joined: Fri Dec 26, 2008 4:21 pm

Re: TdosPrn con Preview e impresoras laser

Postby artu01 » Sat Apr 14, 2012 4:31 am

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
artu01
 
Posts: 397
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview e impresoras laser

Postby ralph » Sat Apr 14, 2012 2:02 pm

Pueden descargar desde aqui: http://www.solupymes.com/fwin/tdosprevn.zip
Ralph del Castillo
Lima PERU
Fwh 23.04, xHb123_10193, MySQL 5.5, BCC 7.3
User avatar
ralph
 
Posts: 70
Joined: Fri Nov 18, 2005 11:15 pm
Location: Lima - PERU

Re: TdosPrn con Preview e impresoras laser

Postby artu01 » Sat Apr 14, 2012 6:08 pm

Gracias, Ralph
hare pruebas y te cuento
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 397
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview e impresoras laser

Postby ltorres » Mon May 14, 2012 5:12 pm

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
ltorres
 
Posts: 42
Joined: Mon Jan 17, 2011 3:44 pm
Location: Lima - Peru

Re: TdosPrn con Preview e impresoras laser

Postby anserkk » Tue May 15, 2012 5:53 am

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

Re: TdosPrn con Preview e impresoras laser

Postby ltorres » Fri May 18, 2012 3:32 am




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

Re: TdosPrn con Preview e impresoras laser

Postby artu01 » Tue May 22, 2012 7:11 pm

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
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 397
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: TdosPrn con Preview e impresoras laser

Postby anserkk » Wed May 23, 2012 5:57 am

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

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 143 guests

cron