FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Impresion PDF en espejo (Solucionado)
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Impresion PDF en espejo (Solucionado)
Posted: Mon Dec 03, 2018 03:18 PM
Estimados:
Tengo un problema al emitir un PDF desde el Preview con PRINT. Me sale en espejo como muestra la figura

El programa para emitir el reporte es el siguiente
Code (fw): Select all Collapse
STATIC FUNCTION Recaudo(cEan,cNumRef,nImporte,dFechaMax)
LOCAL oPrn, oFont1, oFont2, oFont3

      
  AddFontResource( "Bar25ifh.ttf" )
  DEFINE FONT oFont1 NAME "TAHOMA"          SIZE -24, 48  OF oPrn
  DEFINE FONT oFont2 NAME "Arial"           SIZE -24, 48  BOLD OF oPrn      


   PRINT oPrn NAME "Recaudo" PREVIEW
      PAGE
         @ 1.0, 1   PRINT TO oPrn TEXT "Codigo EAN:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"
         @ 1.0, 4.1 PRINT TO oPrn TEXT cEan ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"
         @ 1.5, 1   PRINT TO oPrn TEXT "Referencia:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"
         @ 1.5, 4.1 PRINT TO oPrn TEXT cNumRef ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"
         @ 2.0, 1   PRINT TO oPrn TEXT "Importe:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"
         @ 2.0, 4.1 PRINT TO oPrn TEXT STR(nImporte,12,2) ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"
         @ 2.5, 1   PRINT TO oPrn TEXT "Fecha pago:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"
         @ 2.5, 4.1 PRINT TO oPrn TEXT DTOC(dFechaMax) ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"         
         
      ENDPAGE      
   ENDPRINT

   oFont1:End()      // Destroy the font object
   oFont2:End()      // Destroy the font object   

RETURN NIL


Alguna pista del porque?
Gracias de antemano
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Mon Dec 03, 2018 04:13 PM
César, mira aqui, que fantástico:

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=35711

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Impresion PDF en espejo
Posted: Mon Dec 03, 2018 06:08 PM

Hola Karinha, si eso codigo se lo pase yo a Francisco.
El tema es cuando pongo exportar a PDF con el boton del PREVIEW. Me genera el PDF pero con el texto en espejo.

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Mon Dec 03, 2018 06:53 PM
César:

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Mon Dec 03, 2018 06:56 PM
César:

Code (fw): Select all Collapse
#include "FiveWin.ch"

FUNCTION Main()

   LOCAL cEan,cNumRef,nImporte,dFechaMax

   cEan      := "534140083583"
   cNumRef   := "835831528"
   nImporte  := 3853.88
   dFechaMax := DATE()

   Recaudo( cEan, cNumRef, nImporte, dFechaMax )

RETURN NIL

FUNCTION Recaudo( cEan, cNumRef, nImporte, dFechaMax)

   LOCAL oPrn, oFont1, oFont2, oFont3

   // AddFontResource( "Bar25ifh.ttf" )
   AddFontResource( "EAN-13.TTF" )  // TESTE PARA CESAR

   PRINT oPrn NAME "Recaudo" PREVIEW MODAL

      DEFINE FONT oFont1 NAME "Bar 25i f HR"  SIZE  14, 00  OF oPrn
      DEFINE FONT oFont2 NAME "Arial"         SIZE -14, 00  BOLD OF oPrn

      PAGE
         @ 1.0, 1   PRINT TO oPrn TEXT "Codigo EAN:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"

         @ 1.0, 4.1 PRINT TO oPrn TEXT cEan ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"

         @ 1.5, 1   PRINT TO oPrn TEXT "Referencia:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"

         @ 1.5, 4.1 PRINT TO oPrn TEXT cNumRef ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"

         @ 2.0, 1   PRINT TO oPrn TEXT "Importe:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"

         @ 2.0, 4.1 PRINT TO oPrn TEXT STR(nImporte,12,2) ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"

         @ 2.5, 1   PRINT TO oPrn TEXT "Fecha pago:" ;
              SIZE 3,.5 CM FONT oFont1 ALIGN "R"

         @ 2.5, 4.1 PRINT TO oPrn TEXT DTOC(dFechaMax) ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"
         
      ENDPAGE      

   ENDPRINT

   oFont1:End()      // Destroy the font object
   oFont2:End()      // Destroy the font object

   // RemoveFontResource( "Bar25ifh.ttf" )
   RemoveFontResource( "EAN-13.ttf" )

RETURN NIL


Saludos
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Mon Dec 03, 2018 07:15 PM
César,

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Mon Dec 03, 2018 07:16 PM
César, con el Código de Barras:

Code (fw): Select all Collapse
#include "FiveWin.ch"

FUNCTION Main()

   LOCAL cEan,cNumRef,nImporte,dFechaMax

   cEan      := "534140083583"
   cNumRef   := "835831528"
   nImporte  := 3853.88
   dFechaMax := DATE()

   Recaudo( cEan, cNumRef, nImporte, dFechaMax )

RETURN NIL

FUNCTION Recaudo(cEan,cNumRef,nImporte,dFechaMax)

   LOCAL oPrn, oFont1, oFont2, oFont3

   AddFontResource( "Bar25ifh.ttf" )
   // AddFontResource( "EAN-13.TTF" )  // TESTE PARA CESAR

   PRINT oPrn NAME "Recaudo" PREVIEW MODAL

      DEFINE FONT oFont1 NAME "Bar 25i f HR"  SIZE  14, 00  OF oPrn
      DEFINE FONT oFont2 NAME "Arial"         SIZE -14, 00  BOLD OF oPrn

      PAGE
         @ 1.0, 1   PRINT TO oPrn TEXT "Codigo EAN:" ;
              SIZE 3,.5 CM FONT oFont2 ALIGN "R"

         @ 1.0, 4.1 PRINT TO oPrn TEXT cEan ;
                  SIZE 6,.5 CM FONT oFont1 ALIGN "L"

         @ 1.5, 1   PRINT TO oPrn TEXT "Referencia:" ;
              SIZE 3,.5 CM FONT oFont2 ALIGN "R"

         @ 1.5, 4.1 PRINT TO oPrn TEXT cNumRef ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"

         @ 2.0, 1   PRINT TO oPrn TEXT "Importe:" ;
              SIZE 3,.5 CM FONT oFont2 ALIGN "R"

         @ 2.0, 4.1 PRINT TO oPrn TEXT STR(nImporte,12,2) ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"

         @ 2.5, 1   PRINT TO oPrn TEXT "Fecha pago:" ;
              SIZE 3,.5 CM FONT oFont2 ALIGN "R"

         @ 2.5, 4.1 PRINT TO oPrn TEXT DTOC(dFechaMax) ;
                  SIZE 6,.5 CM FONT oFont2 ALIGN "L"
         
      ENDPAGE      

   ENDPRINT

   oFont1:End()      // Destroy the font object
   oFont2:End()      // Destroy the font object

   RemoveFontResource( "Bar25ifh.ttf" )
   // RemoveFontResource( "EAN-13.ttf" )

RETURN NIL
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Impresion PDF en espejo
Posted: Tue Dec 04, 2018 04:16 AM
Gracias Karinha por todas las pruebas, pero tengo el mismo resultado con tu código.
Con el preview se ve asi:

Con el pdf generado con el preview se ve asi:


En esta PC no tengo instalado ni el Acrobat ni el CutePDF ni ningun administrador de archivos PDF.
Cuando instalo en clientes que no tienen esos programas es el problema.
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Tue Dec 04, 2018 11:12 AM
Instale una impresora virtual, por ejemplo:

https://www.pdfmachine.com/

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Impresion PDF en espejo
Posted: Tue Dec 04, 2018 11:24 AM

Si, esa es un solución, pero lo clientes tiene que hacer lo mismo y elegir la impresora virtual como salida cuando quieren exportar a PDF. Y como el Preview tiene la opcion de exportar a PDF es raro que nadie haya tenido este problema no?

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Tue Dec 04, 2018 12:48 PM
No comprendo, por cual razón no instalar el Adobe Acrobat Reader DC?

https://get.adobe.com/br/reader/

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Impresion PDF en espejo
Posted: Tue Dec 04, 2018 01:59 PM

Porque el sistema que entrego lo distribuyo en forma de instalador descargando de la web, y de esa manera dependo de que el cliente que lo descarga (que es un proceso automatico del que no tengo intervesion) tenga instalado el Acrobat Reader.. (u otro similar).

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Tue Dec 04, 2018 02:41 PM
Mira se comprende. Adapta a tu sistema.

Code (fw): Select all Collapse
FUNCTION ShowPDF_READER( cAlias )

   LOCAL oWndPdf, oPdf, cTmp, NFEVisualSUM, nNumNfeSUM, nRecNo, oTaskP

   nRecNo     := ( cAlias )->( RecNo() ) //-> CCE.DBF
   GoTo( nRecNo )

   nNumNfeSUM := VAL( SUBSTR( ( cAlias )->CHAVE, 29, 6 ) )

   NFEVisualSUM := "C:\NFEPDF\"+"CCE"+ALLTRIM( STR( nNumNfeSUM ) )+".PDF"

   /*
   MsgWait( "LOCALIZANDO O ARQUIVO DA CARTA DE CORRECAO", ;
            "AGUARDE UM MOMENTO POR FAVOR...           ", 2.5 )
   */

   // USANDO ADOBE READER DIRETO VIA CODIGO - ACTIVEX DO FWH17.01
   IF .NOT. FILE( NFEVisualSUM )  

      ? "Arqchivo no localizado"

      RETURN NIL

   ENDIF

   DEFINE WINDOW oWndPdf TITLE "FiveWin ActiveX Support - Visualizar/Imprimir o *.PDF Usando o Adobe Reader"

   oPdf = TActiveX():New( oWndPdf, "AcroPDF.PDF.1" , 1, 1, 20, 50 )

   oWndPdf:oClient := oPdf

   oPdf : src = NFEVisualSUM

   // Mostra Preview Pequeno no lado esquerdo da tela...
   // oPdf:Do( "SetPageMode", "thumbnail and pages" )

   oPdf:SetProp( "Src", cTmp )

   oPdf:Do( "LoadFile", Lfn2Sfn(cTmp) )

   oPdf:Do( "GetVersions" )

   oPdf:Do( "SetCurrentPage", 1 )

   // oPdf:Print() // Nao funciona direto na impressora..
   // oPdf:Do( "PrintAll" )  // Assim funciona. pede a impressao

   // Mostra a Barra de Botoes do ADOBE READER
   oPdf:Do( "SetShowToolbar", .T. )

   // Liga/Desliga barra de Scroll do lado direto do Adobe Reader
   oPdf:Do( "SetShowScrollbars", .T. )  // Liga/Desliga Scroll

   ACTIVATE WINDOW oWndPdf MAXIMIZED      ;
            ON INIT( PDFActivex( oPdf ) ) ;
            VALID( oWndPdf := NIL, oPdf:End(), .T. )

RETURN NIL

FUNCTION PDFActivex( MyProgID )

   LOCAL adretor := .T.
 
   if IsActivex( "PDF.PdfCtrl.1" ); MyProgID := "PDF.PdfCtrl.1"; endif
   if IsActivex( "PDF.PdfCtrl.2" ); MyProgID := "PDF.PdfCtrl.2"; endif
   if IsActivex( "PDF.PdfCtrl.3" ); MyProgID := "PDF.PdfCtrl.3"; endif
   if IsActivex( "PDF.PdfCtrl.4" ); MyProgID := "PDF.PdfCtrl.4"; endif
   if IsActivex( "PDF.PdfCtrl.5" ); MyProgID := "PDF.PdfCtrl.5"; endif
   if IsActivex( "PDF.PdfCtrl.6" ); MyProgID := "PDF.PdfCtrl.6"; endif
   if IsActivex( "PDF.PdfCtrl.7" ); MyProgID := "PDF.PdfCtrl.7"; endif
   if IsActivex( "acroPDF.PDF.1" ); MyProgID := "acroPDF.PDF.1"; endif
   if IsActivex( "acroPDF.PDF.2" ); MyProgID := "acroPDF.PDF.2"; endif

   IF Empty( MyProgID )

      MsgInfo( "PDF Activex não instalado !!!"+CRLF+ ;
               " É necessário que seja instalado o programa ADOBE READER, consulte o suporte do sistema.",.F.)

      adretor := .F.

   ENDIF

RETURN(adretor)


Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: Impresion PDF en espejo
Posted: Wed Dec 05, 2018 11:40 AM

Hola Karinha: Gracias por tu interes. La idea es poder generar el PDF sin tener el Acrobat Reader ni ningun otro complemento instalado, y que lo genere sin el efecto espejo.

Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: Impresion PDF en espejo
Posted: Wed Dec 05, 2018 12:33 PM
Code (fw): Select all Collapse
   LOCAL cFile

   nPDF := 1 // 2 3 4 5 6

   cFile := "C:\MYPDF\"+"MYPDF"+ALLTRIM( nPDF )+".PDF"

   PRINT oPrn NAME "MYPDF" FILE cFile

Ó

   FWSavePreviewToPDF( oPrn )  // Esta en: PRV2PDF.PRG do Five.


Saludos
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341