Page 1 of 1

Preview and save to pdf at the same time

Posted: Mon Jul 02, 2018 11:10 am
by hua
How to preview a report using tprinter and at the same time have a copy of it silently saved as a pdf in the background?

My experiment so far tends to have the exe just silently terminates. I was using FWH15.01 and FWSavePreviewToPdf()

TIA

Re: Preview and save to pdf at the same time

Posted: Mon Dec 31, 2018 7:48 pm
by puenteda
I made this changes in rpreview.prg, in:

METHOD PrintPage() CLASS TPreview

....

if ! lCancel
MsgRun( ::oDevice:cDocument, "Imprimiendo Reporte",;
{ || ::PrintPrv( nil, nOption, nFirst, nLast ) } )

// daniel 2016-07-29

* ? 'ACA GUARDAR PDF',oApp:lGuardarPDF,oApp:cImprimiendo

IF oApp:lGuardarPDF

IF oApp:cImprimiendo == 'RECIBO'
cRutaPDF:=oApp:cRutaPDFRecibos
ELSEIF oApp:cImprimiendo == 'FE'
cRutaPDF:=oApp:cRutaPDFFE
ELSEIF oApp:cImprimiendo == 'PRESUPUESTO'
cRutaPDF:=oApp:cRutaPDFPresupuestos
ENDIF

MsgRun( ::oDevice:cDocument, "Guardando PDF",;
{ || ::SaveAs( .t.,cRutaPdf+'\'+::oDevice:cDocument,.F. ) } )
ENDIF

endif