johnp Posted January 7, 2013 Share 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. Link to comment Share on other sites More sharing options...
mhmda Posted January 7, 2013 Share 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; Link to comment Share on other sites More sharing options...
Ronak Posted January 7, 2013 Share Posted January 7, 2013 UniSession.SendFile(UniServerModule.LocalCachePath +fn, fn); Link to comment Share on other sites More sharing options...
johnp Posted January 7, 2013 Author Share 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; Link to comment Share on other sites More sharing options...
Ronak Posted January 8, 2013 Share Posted January 8, 2013 http://forums.unigui.com/index.php?/topic/2669-fastreport-demo/ Link to comment Share on other sites More sharing options...
Anachronox Posted May 21, 2013 Share Posted May 21, 2013 This may help : http://forums.unigui.com/index.php?/topic/2333-open-pdf-in-the-browser-window/?p=14923 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now