#include "fivewin.ch"
function Main()
TPreview():bSaveAsPDF := { | oPreview | FWSavePreviewToPDF( oPreview ) }
XBrowse( "CUSTOMER.DBF" )
return nil#include "fivewin.ch"
function Main()
TPreview():bSaveAsPDF := { | oPreview | FWSavePreviewToPDF( oPreview ) }
XBrowse( "CUSTOMER.DBF" )
return nil// 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 nilCon harupdf creo sea el mejor.
Saludos.
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...
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.
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.
METHOD SaveAs( lPDF, cFile, lView ) CLASS TPreview
CATCH
lWordPDF := .f.
// MsgInfo( FWString( "PDF Plugin Error" ), FWString( "Information" ) )
ENDMETHOD 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 nilMETHOD 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 cFileCmsoft, si entiendo, usted estaba usando un RPREVIEW.PRG de una versión anterior a la que se utiliza actualmente. ¿Estoy correcto?
Saludos.
Asi es Karinha!