(06-15-2022, 02:49 AM)DanBarclay Wrote: I don't use Fast Report, but I have followed conversations here regarding threading issues with that lib. It is not intended for multi threading like a web server. The solution is to use the CGIRunner component and place the report code in a single thread project.
Check here:
https://www.atozed.com/forums/showthread...02#pid2402
Note that in post 9 of that thread, Jose has posted a link to sample code.
Dan
There is no threading issues with fastreport if you set all of these settings.
// this code is very important and needs to be called right after the report is created.
lFrxReport.EngineOptions.EnableThreadSafe := True;
lFrxReport.EngineOptions.UseGlobalDataSetList := False;
lFrxReport.ReportOptions.Compressed := True;
lFrxReport.EngineOptions.SilentMode := True;
lFrxReport.EngineOptions.DestroyForms := False;
lFrxReport.EngineOptions.UseFileCache := False;
lFrxReport.ShowProgress := False;
Here is also a procedure for using ReportBuilder if anyone needs it.
procedure fxProcess_Report(ARBreport:TppReport;Output_type
tring; Send_Stream:boolean=false;AFileName
tring='';APdfPassword
tring='');var lFileName,
lURL,
lFileDir
tring;lMS : TMemoryStream;
lPDFDevice: TppPDFDevice;
begin
try
with ARBreport do
begin
AllowPrintToFile := False;
ShowPrintDialog := False;
TextFileName := lFileDir;
DeviceType := 'PDF';
ModalCancelDialog := false;
ModalPreview := false;
ShowCancelDialog := false;
lMS := TMemoryStream.Create;
lPDFDevice := TppPDFDevice.Create(nil);
try
lPDFDevice.PDFSettings := ARBreport.PDFSettings;
lPDFDevice.OutPutSTream := lMS;
lPDFDevice.Publisher := ARBreport.publisher;
ARBreport.PrintToDevices;
lURL := IWappCache.TIWAppCache.StreamToCacheFile(WebApplication, lMS, TIWMimeTypes.GetAsString('.' + 'PDF'), ctSession);
WebApplication.NewWindow( lURL
, 'Report'
, 0
, 0
, [woResizable, woDetectBlock]
);
finally
lPDFDevice.free;
lMS.free;
end;
end;
except
raise;
end;
end;

