Imprimir archivo .TXT con Printer.prg

Imprimir archivo .TXT con Printer.prg

Postby karinha » Fri Sep 04, 2020 4:22 pm

Buenos dias, como hago para imprimir archivos *.TXT con PRINTER.PRG?

Gracias, 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: Imprimir archivo .TXT con Printer.prg

Postby nageswaragunupudi » Sat Sep 05, 2020 3:43 am

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local cText := MEMOREAD( "c:\fwh\samples\yunus.prg" )
   local oPrn, oFont

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "COURIER NEW" SIZE 0,-10 OF oPrn
   do while !Empty( cText )
   PAGE
      @ 1,1 PRINT TO oPrn TEXT @cText SIZE 7,10 INCHES FONT oFont
   ENDPAGE
   enddo
   ENDPRINT
   RELEASE FONT oFont

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Imprimir archivo .TXT con Printer.prg

Postby karinha » Sat Sep 05, 2020 5:51 am

Perfecto Mister Rao y Aun, puedo generar el PDF del .TXT.

Code: Select all  Expand view

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL cText := MEMOREAD( "c:\fwh\samples\yunus.prg" )

   LOCAL oPrn, oFont

   PRINT oPrn PREVIEW

      DEFINE FONT oFont NAME "COURIER NEW" SIZE 0, -10 OF oPrn

      WHILE .NOT. EMPTY( cText )

         SYSREFRESH()

         PAGE

            @ 1, 1 PRINT TO oPrn TEXT @cText SIZE 7, 10 INCHES FONT oFont

         ENDPAGE

      ENDDO

      IF lPdfImp
                          // Problem:
        oPrn:lMeta = .F.  // .T. -> Defecto  - .F. Genera el PDF.

      ENDIF

   ENDPRINT

   IF lPdfImp

      FWSavePreviewToPDF( oPrn, "ARCHIVO.pdf", .F. )

   ENDIF

   RELEASE FONT oFont

RETURN NIL
 


Regards, 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: Imprimir archivo .TXT con Printer.prg

Postby nageswaragunupudi » Sat Sep 05, 2020 8:30 am

This generates the pdf silently.
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local cText := MEMOREAD( "c:\fwh\samples\yunus.prg" )
   local oPrn, oFont

   PRINT oPrn FILE "archivo.pdf"
   DEFINE FONT oFont NAME "COURIER NEW" SIZE 0,-10 OF oPrn
   do while !Empty( cText )
   PAGE
      @ 1,1 PRINT TO oPrn TEXT @cText SIZE 7,10 INCHES FONT oFont
   ENDPAGE
   enddo
   ENDPRINT
   RELEASE FONT oFont

return nil


This generates pdf first and then shows the pdf file in default application.
Code: Select all  Expand view

   PRINT oPrn PREVIVEW FILE "archivo.pdf"
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Imprimir archivo .TXT con Printer.prg

Postby karinha » Sat Sep 05, 2020 1:36 pm

Perfeito... Perfect Mister Nages!!! Many thanks.

Code: Select all  Expand view

#Include "FiveWin.ch"

FUNCTION Main()

   LOCAL WNOMBREARQPDF

   MsgRun( "GENERANDO ARCCHIVO *.PDF...", ;
           "Por Favor, Aguarde...      ", ;
           { || WinExec( Generar_PDF() ), 3 } )

   // Perfect, mister Nages, Thank You
   IF FILE( "ARCHIVO.PDF" )

      WNOMBREARQPDF := "c:\fwh\samples\archivo.pdf"

      ShellExecute( 0, "Print", WNOMBREARQPDF,,, 3 )

   ENDIF

RETURN NIL

FUNCTION Generar_PDF()

   LOCAL cText := MEMOREAD( "c:\fwh\samples\arq.txt" )
   LOCAL oPrn, oFont

   PRINT oPrn FILE "archivo.pdf"

      DEFINE FONT oFont NAME "COURIER NEW" SIZE 0,-10 OF oPrn

      WHILE .NOT. EMPTY( cText )

         SYSREFRESH()

         CURSORWAIT()

         PAGE

            @ 1,1 PRINT TO oPrn TEXT @cText SIZE 7,10 INCHES FONT oFont

         ENDPAGE

      ENDDO

   ENDPRINT

   RELEASE FONT oFont

   CURSORARROW()

RETURN NIL
 


Regards, 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: Imprimir archivo .TXT con Printer.prg

Postby FranciscoA » Sun Sep 06, 2020 5:31 pm

nageswaragunupudi wrote:This generates the pdf silently.
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local cText := MEMOREAD( "c:\fwh\samples\yunus.prg" )
   local oPrn, oFont

   PRINT oPrn FILE "archivo.pdf"
   DEFINE FONT oFont NAME "COURIER NEW" SIZE 0,-10 OF oPrn
   do while !Empty( cText )
   PAGE
      @ 1,1 PRINT TO oPrn TEXT @cText SIZE 7,10 INCHES FONT oFont
   ENDPAGE
   enddo
   ENDPRINT
   RELEASE FONT oFont

return nil


This generates pdf first and then shows the pdf file in default application.
Code: Select all  Expand view

   PRINT oPrn PREVIVEW FILE "archivo.pdf"
 


Sr. Rao.
A partir de cual versión funciona esto?
Gracias.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Imprimir archivo .TXT con Printer.prg

Postby nageswaragunupudi » Mon Sep 07, 2020 3:28 am

FWH1304
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Imprimir archivo .TXT con Printer.prg

Postby FranciscoA » Mon Sep 07, 2020 5:07 pm

nageswaragunupudi wrote:FWH1304

Muchas gracias.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests