johnp Posted January 7, 2013 Posted January 7, 2013 Hello, I am using FastReport with uniGUI. Works OK. I am able to export my report to a PDF and save to the server. I would like to return PDF to the client using sendfile once saved. This is the line of code I have Sendfile.(ExtractFilePath(Application.ExeName) + 'files\' + tempstr1,true); I cannot seem to send a file, or get this to work. Does sendfile work? Is there another way? John P. Quote
mhmda Posted January 7, 2013 Posted January 7, 2013 You can use this: * I put the fastreport components in my DataModule. * I use this code 'Onclick' button. procedure TfrmMenu.MyFrxShowExp(); var fn:String; FormUrlView1:TURLFrame; begin fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report. DataModule1.frxReport5.PrintOptions.ShowDialog := False; DataModule1.frxReport5.ShowProgress:=false; DataModule1.frxReport5.PrintOptions.ShowDialog:=false; DataModule1.frxReport5.EngineOptions.SilentMode:=True; DataModule1.frxPDFExport1.Background:=True; DataModule1.frxPDFExport1.ShowProgress:=False; DataModule1.frxPDFExport1.ShowDialog:=False; DataModule1.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn; DataModule1.frxPDFExport1.DefaultPath := ''; if Mainform.WebMode then begin DataModule1.frxReport5.PrepareReport(); // Create Report DataModule1.frxReport5.Export(DataModule1.frxPDFExport1); // Export Report FormUrlView1:=TURLFrame.Create(UniApplication); FormUrlView1.URLFrm.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame FormUrlView1.Show; end else begin DataModule1.frxReport5.ShowReport(); end; end; Quote
Ronak Posted January 7, 2013 Posted January 7, 2013 UniSession.SendFile(UniServerModule.LocalCachePath +fn, fn); Quote
johnp Posted January 7, 2013 Author Posted January 7, 2013 First thanks for your help. I need further explanation on the use of the var FormUrlView1:TURLFrame; I have not seen TURLFrame before. I am not sure what else I need to create. Do I need to create a special uniGUI frame or view? John BTW Sendfile does not work for me either. Does send file work? I tried a very simple path and the compiler does not recognize sendfile. You can use this: * I put the fastreport components in my DataModule. * I use this code 'Onclick' button. procedure TfrmMenu.MyFrxShowExp(); var fn:String; FormUrlView1:TURLFrame; begin fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report. DataModule1.frxReport5.PrintOptions.ShowDialog := False; DataModule1.frxReport5.ShowProgress:=false; DataModule1.frxReport5.PrintOptions.ShowDialog:=false; DataModule1.frxReport5.EngineOptions.SilentMode:=True; DataModule1.frxPDFExport1.Background:=True; DataModule1.frxPDFExport1.ShowProgress:=False; DataModule1.frxPDFExport1.ShowDialog:=False; DataModule1.frxPDFExport1.FileName := UniServerModule.LocalCachePath + fn; DataModule1.frxPDFExport1.DefaultPath := ''; if Mainform.WebMode then begin DataModule1.frxReport5.PrepareReport(); // Create Report DataModule1.frxReport5.Export(DataModule1.frxPDFExport1); // Export Report FormUrlView1:=TURLFrame.Create(UniApplication); FormUrlView1.URLFrm.URL := UniServerModule.LocalCacheURL + fn; // Displayed on UniURLFrame FormUrlView1.Show; end else begin DataModule1.frxReport5.ShowReport(); end; end; Quote
Ronak Posted January 8, 2013 Posted January 8, 2013 http://forums.unigui.com/index.php?/topic/2669-fastreport-demo/ Quote
Anachronox Posted May 21, 2013 Posted May 21, 2013 This may help : http://forums.unigui.com/index.php?/topic/2333-open-pdf-in-the-browser-window/?p=14923 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.