Page 1 of 2

Impresion PDF en espejo (Solucionado)

PostPosted: Mon Dec 03, 2018 3:18 pm
by cmsoft
Estimados:
Tengo un problema al emitir un PDF desde el Preview con PRINT. Me sale en espejo como muestra la figura
Image
El programa para emitir el reporte es el siguiente
Code: Select all  Expand view

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

Re: Impresion PDF en espejo

PostPosted: Mon Dec 03, 2018 4:13 pm
by karinha
César, mira aqui, que fantástico:

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

Saludos.

Re: Impresion PDF en espejo

PostPosted: Mon Dec 03, 2018 6:08 pm
by cmsoft
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.

Re: Impresion PDF en espejo

PostPosted: Mon Dec 03, 2018 6:53 pm
by karinha
César:

Image

Re: Impresion PDF en espejo

PostPosted: Mon Dec 03, 2018 6:56 pm
by karinha
César:

Code: Select all  Expand view

#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

Re: Impresion PDF en espejo

PostPosted: Mon Dec 03, 2018 7:15 pm
by karinha
César,

Image

Re: Impresion PDF en espejo

PostPosted: Mon Dec 03, 2018 7:16 pm
by karinha
César, con el Código de Barras:

Code: Select all  Expand view

#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
 

Re: Impresion PDF en espejo

PostPosted: Tue Dec 04, 2018 4:16 am
by cmsoft
Gracias Karinha por todas las pruebas, pero tengo el mismo resultado con tu código.
Con el preview se ve asi:
Image
Con el pdf generado con el preview se ve asi:
Image

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.

Re: Impresion PDF en espejo

PostPosted: Tue Dec 04, 2018 11:12 am
by karinha
Instale una impresora virtual, por ejemplo:

https://www.pdfmachine.com/

Saludos.

Re: Impresion PDF en espejo

PostPosted: Tue Dec 04, 2018 11:24 am
by cmsoft
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?

Re: Impresion PDF en espejo

PostPosted: Tue Dec 04, 2018 12:48 pm
by karinha
No comprendo, por cual razón no instalar el Adobe Acrobat Reader DC?

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

Saludos.

Re: Impresion PDF en espejo

PostPosted: Tue Dec 04, 2018 1:59 pm
by cmsoft
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).

Re: Impresion PDF en espejo

PostPosted: Tue Dec 04, 2018 2:41 pm
by karinha
Mira se comprende. Adapta a tu sistema.

Code: Select all  Expand view

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.

Re: Impresion PDF en espejo

PostPosted: Wed Dec 05, 2018 11:40 am
by cmsoft
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.

Re: Impresion PDF en espejo

PostPosted: Wed Dec 05, 2018 12:33 pm
by karinha
Code: Select all  Expand view

   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