Page 2 of 2

Re: Impresion PDF en espejo

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

#include "fivewin.ch"

function Main()

   TPreview():bSaveAsPDF := { | oPreview | FWSavePreviewToPDF( oPreview ) }

   XBrowse( "CUSTOMER.DBF" )

return nil
 

Re: Impresion PDF en espejo

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

// Generate a PDF from a PRINTER object without preview

#include "FiveWin.ch"

function Main()

   local oPrn

   PRINT oPrn PREVIEW NAME "ORCAM"

      PAGE

      oPrn:CmSay( 2, 2, "Hello world" )

      ENDPAGE

      oPrn:lMeta = .F.

   ENDPRINT

   FWSavePreviewToPDF( oPrn )

return nil
 

Re: Impresion PDF en espejo

PostPosted: Wed Dec 05, 2018 12:43 pm
by karinha
Con harupdf creo sea el mejor.

Saludos.

Re: Impresion PDF en espejo

PostPosted: Wed Dec 05, 2018 1:12 pm
by karinha
Miara este post, donde pruebo HARUPDF con el editor SUMATRAPDF que puedes poner "invisible" en tu sistema, mui fácil de usar.

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

Fantastic Job.

Saludos.

Re: Impresion PDF en espejo

PostPosted: Thu Dec 06, 2018 9:07 pm
by cmsoft
Karinha:
Muchisimas gracias por tu tiempo... Voy a investigar la opcion de HARUPDF. Igualmente la idea era usar el Preview de Fivewin y que cuando genere el PDF no sea en espejo...

Re: Impresion PDF en espejo

PostPosted: Sat Dec 08, 2018 11:18 am
by Carlos Mora
César,
por lo extraño del problema, y viendo que no se repite en otros equipos ¿No tendrá algo que ver la configuración de la impresora? Prueba de poner como impresora por defecto una impresora de pdf o algo así, que no tenga nada que ver con una printer real, a ver si es eso.
Puede que tu o alguien más haya usado la impresora para hacer alguna impresión de esas que se usan para transferencias, o tengas configurado como papel 'papel para transferencias' y eso esté cambiando el comportamiento.

Re: Impresion PDF en espejo

PostPosted: Mon Dec 10, 2018 10:52 am
by cmsoft
Hola Carlos, gracias por responder...
He hecho las pruebas, en equipos que no tienen ninguna aplicación de manejo de PDF y es ahí donde me da el error. Es extraño porque si el reporte viene de la clase Report no tiene ese efecto, pero si viene de la clase Print ahi si da el efecto espejo. Tambien me resulta extraño que a nadie le haya dado ese efecto nunca, y que nunca se haya reportado. Tal vez pensaba que debería tener alguna consideración al utilizar la clase print, y es por eso que me da ese efecto.

Re: Impresion PDF en espejo

PostPosted: Mon Dec 10, 2018 12:45 pm
by karinha
Mira en RPREVIEW.PRG

Code: Select all  Expand view

METHOD SaveAs( lPDF, cFile, lView ) CLASS TPreview

      CATCH
         lWordPDF    := .f.
//         MsgInfo( FWString( "PDF Plugin Error" ), FWString( "Information" ) )
      END
 


Saludos.

Re: Impresion PDF en espejo

PostPosted: Mon Dec 10, 2018 8:51 pm
by cmsoft
Hola Karinha!!
Otra vez gracias por tu tiempo...
Efectivamente ahi estaba el problema...
Tenia esto:
Code: Select all  Expand view

METHOD SaveAs( lPDF ) CLASS TPreview

   local oWord, nVer, oDoc
   local cFile, cExt, cMsg, lView

   if lPDF
      if ValType( ::bSaveAsPDF ) == 'B'
         return Eval( ::bSaveAsPDF, Self )
      endif
   else
      if ValType( ::bSaveAsWord ) == 'B'
         return Eval( ::bSaveAsWord, Self )
      endif
   endif

   oWord       := WinWordObj()
   if oWord == nil
      return FWSavePreviewToPDF( Self )
   endif
   nVer        := Val( oWord:Version )

   if lPDF
/*
      if nVer < 12.0
         MsgInfo( "This option requires Word 2007 or later" )
         return nil
      elseif !WordHasPDFPlugIn()
         MsgInfo( "Download and Install" + CRLF + ;
                  "SaveAsPDF plugin from" + CRLF + ;
                  "Microsoft Office Online Website" )
         return nil
      endif
*/


      if nVer >= 12.0 .and. WordHasPDFPlugIn()
         cExt  := "*.pdf"
      else
         return FWSavePreviewToPDF( Self )
      endif
   else
      cExt     := If( nVer < 12.0, "*.doc", "*.docx; *.doc" )
   endif
   cMsg        := If( lPDF, "PDF", "Doc" ) + ;
                      " File to Save( " + cExt + ") |" + cExt + "|"
   if Empty( cFile := cGetFile( cMsg, "File to Save", 1, CurDir(), , .t. ) )
      return nil
   endif
   if !( Lower( cFileExt( cFile ) ) $ cExt )
      cFile    := cFilePath( cFile ) + cFileNoExt( cFile ) + ;
                  If( lPDF, ".pdf", If( nVer < 12.0, ".doc", ".docx" ) )
   endif

   lView       := MsgYesNo( "View " + cFile + "?" )
   oDoc        := ConvertToWordDoc( Self )

   if oDoc != nil
      TRY
         oDoc:ExportAsFixedFormat( cFile, 17, lView )
      CATCH
         MsgInfo( "PDF Plugin Error" )
      END
      if lPDF
         oDoc:Close( .f. )
      else
         if nVer >= 12.0
            oDoc:SaveAs( cFile, If( Lower( cFileExt( cFile ) ) == 'doc', 0, 16 ) )
         else
            oDoc:SaveAs( cFile )
         endif
         if lView
            oDoc:Application:Visible := .t.
         else
            oDoc:Close( .f. )
         endif
      endif
   endif

return nil
 

Y en realidad iba esto:
Code: Select all  Expand view

METHOD SaveAs( lPDF, cFile, lView ) CLASS TPreview

   static lWordPDF   := .t.

   local oWord, nVer, oDoc
   local cExt, cMsg

   if lPDF
      if ValType( ::bSaveAsPDF ) == 'B'
         return Eval( ::bSaveAsPDF, Self, cFile, lView )
      elseif ! lWordPDF // tested earlier and found Word with PDF plugin not availble
         return FWSavePreviewToPDF( Self, cFile, lView )
      endif
   else
      if ValType( ::bSaveAsWord ) == 'B'
         return Eval( ::bSaveAsWord, Self, cFile, lView )
      endif
   endif

   oWord       := WinWordObj()
   if oWord == nil
      lWordPDF    := .f.
      if lPDF
        return FWSavePreviewToPDF( Self, cFile, lView )
      ELSE
        return ToWordDocViaWriter( Self, , "W" )
      Endif
   endif
   nVer        := Val( oWord:Version )

   if lPDF
      if nVer >= 12.0 .and. WordHasPDFPlugIn()
         cExt  := "*.pdf"
      else
         lWordPDF    := .f.
         return FWSavePreviewToPDF( Self, cFile, lView )
      endif
   else
      cExt = If( nVer < 12.0, "*.doc", "*.docx; *.doc" )
   endif
   cMsg    = If( lPDF, "PDF", "Doc" ) + " " + ;
             FWString( "File to Save" ) + "( " + cExt + ") |" + cExt + "|"

   if Empty( cFile ) .and. Empty( cFile := cGetFile( cMsg, FWString( "File to Save" ), 1, CurDir(), , .t. ) )
      return nil
   endif

   if !( Lower( cFileExt( cFile ) ) $ cExt )
      cFile = cFilePath( cFile ) + cFileNoExt( cFile ) + ;
              If( lPDF, ".pdf", If( nVer < 12.0, ".doc", ".docx" ) )
   endif

   DEFAULT lView := MsgYesNo( FWString( "View" ) + " " + cFile + "?", FWString( "Please select" ) )
   oDoc  = ConvertToWordDoc( Self )

   if oDoc != nil
      TRY
         oDoc:ExportAsFixedFormat( cFile, 17, lView )
      CATCH
         lWordPDF    := .f.
//         MsgInfo( FWString( "PDF Plugin Error" ), FWString( "Information" ) )
      END
      if lPDF
         oDoc:Close( .f. )
         if ! lWordPDF
            // word failed to save as PDF due to PDF Plugin Error
            return FWSavePreviewToPDF( Self, cFile, lView )
         endif
      else
         if nVer >= 12.0
            oDoc:SaveAs( cFile, If( Lower( cFileExt( cFile ) ) == 'doc', 0, 16 ) )
         else
            oDoc:SaveAs( cFile )
         endif
         if lView
            oDoc:Application:Visible := .t.
         else
            oDoc:Close( .f. )
         endif
      endif
   endif

return cFile
 

Muchas gracias por tu tiempo... Siempre muy amable con el foro..

Re: Impresion PDF en espejo (Solucionado)

PostPosted: Tue Dec 11, 2018 1:06 pm
by karinha
Cmsoft, si entiendo, usted estaba usando un RPREVIEW.PRG de una versión anterior a la que se utiliza actualmente. ¿Estoy correcto?

Saludos.

Re: Impresion PDF en espejo (Solucionado)

PostPosted: Tue Dec 11, 2018 7:46 pm
by cmsoft
Asi es Karinha!