FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Preview and save to pdf at the same time
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Preview and save to pdf at the same time
Posted: Mon Jul 02, 2018 11:10 AM

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.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 24
Joined: Thu Oct 02, 2014 03:51 AM
Re: Preview and save to pdf at the same time
Posted: Mon Dec 31, 2018 07:48 PM

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

Continue the discussion