简单一点的(05)UniGUI何输出FastReport的pdf

https://www.cnblogs.com/fireboxsoft/p/10293068.html

新建一个打印预览uniForm窗口printU

 主窗口引用它,新建一个unibutton打印按钮. 

uses
 printU;
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  printU.UniForm1.ShowModal(nil);
end;

 

 

uses
 ServerModule;

procedure TUniForm1.UniFormBeforeShow(Sender: TObject);
var url: string;
begin
//        frxReport1.LoadFromFile(UniServerModule.FilesFolderPath+'aaaa.fr3');   //存放在files目录下面   也可以 直接设置,不保存为文件
        frxReport1.PrintOptions.ShowDialog := false;
        frxReport1.ShowProgress := false;
        frxReport1.EngineOptions.SilentMode := true;
        frxReport1.EngineOptions.EnableThreadSafe := true;
        frxReport1.EngineOptions.DestroyForms := false;
        frxReport1.EngineOptions.UseGlobalDataSetList := false;

        frxPDFExport1.Background:=true;
        frxPDFExport1.ShowProgress:=False;
        frxPDFExport1.ShowDialog:=false;
        frxPDFExport1.FileName:=UniServerModule.NewCacheFileUrl(False,'pdf','','',url,true);
        frxPDFExport1.DefaultPath := '';

       frxReport1.PreviewOptions.AllowEdit := false;
        frxReport1.PrepareReport();
        frxReport1.Export(frxPDFExport1);

        UniURLFrame1.URL := url;
end;