Alessandro Posted October 2, 2015 Posted October 2, 2015 Hi! I created a report generator FastReport in my system. When show (PDF) file, appears in another browser tab. Its ok. It turns out that when the generator creates the report, the file is saved in "UniServerModule.LocalCachePath" site server. I want the report generator to create the file and save this on the local machine of the client, perhaps in a specified folder (I create) or in the customer's own cache folders. How to do this? Thank you. ----------------------------------- Olá! Eu criei um gerador de relatórios em FastReport para meu sistema. Quando mando visualizar o arquivo (PDF), aparece em uma outra aba do browser. Até aí tudo certo. Acontece que, quando o gerador cria o relatório, o arquivo é salvo no local UniServerModule.LocalCachePath, servidor. Eu quero que quando o gerador do relatório criar o arquivo, este salve na maquina local do cliente, talvez numa pasta específica (que eu mande criar) ou nas pastas cache do próprio cliente. Como fazer isso? Obrigado. Quote
Administrators Farshad Mohajeri Posted October 2, 2015 Administrators Posted October 2, 2015 You can not do this directly. It is against browser security rules. You must use SendFile() to send PDF to user and user will decide where to save it. 1 Quote
adragan Posted October 2, 2015 Posted October 2, 2015 "I want the report generator to create the file and save this on the local machine of the client, perhaps in a specified" SendFile() does that in the Download folder of your browser. 1 Quote
Alessandro Posted November 16, 2015 Author Posted November 16, 2015 procedure TUniMainModule.MyFrxDownload(frxReport: TfrxReport); var fn:String; FormUrlView1: TFm_Rel; begin fn:= 'R-' + FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; frxReport.PrintOptions.ShowDialog := False; frxReport.ShowProgress:=false; frxReport.PrintOptions.ShowDialog:=false; frxReport.EngineOptions.SilentMode:=True; frxPDFExport.Background:=True; frxPDFExport.ShowProgress:=False; frxPDFExport.ShowDialog:=False; frxPDFExport.FileName := UniServerModule.LocalCachePath + fn; frxPDFExport.DefaultPath := ''; frxReport.PrepareReport(); frxReport.Export(frxPDFExport); UniSession.SendFile(UniServerModule.LocalCachePath + fn, fn); FormUrlView1 := TFm_Rel.Create(UniApplication); FormUrlView1.uniURLFrame1.URL := UniServerModule.LocalCacheURL + fn; FormUrlView1.Show; end; 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.