Preview and save to pdf at the same time

Post Reply
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Preview and save to pdf at the same time

Post 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
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
puenteda
Posts: 19
Joined: Thu Oct 02, 2014 3:51 am

Re: Preview and save to pdf at the same time

Post 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
Post Reply