Если вы просто хотите избежать сохранения большого количества файлов, вы можете создать новый класс экспорта для печати файла сразу после его создания и мгновенного удаления.
Вы можете создать совершенно новый класс экспорта, который печатает растровое изображение из памяти (например, используя класс TPrinter и рисуя растровое изображение непосредственно на холсте принтера) ... вы узнаете, как проверять исходный файл класса TfrxBMPExport .
Возьмем этот непроверенный код в качестве примера, который поможет вам создать новый класс для сохранения / печати / удаления:
type
TBMPPrintExport = class(TfrxBMPExport)
private
FCurrentPage: Integer;
FFileSuffix: string;
protected
function Start: Boolean; override;
procedure StartPage(Page: TfrxReportPage; Index: Integer); override;
procedure Save; override;
end;
{ TBMPPrintExport }
procedure TBMPPrintExport.Save;
var
SavedFileName: string;
begin
inherited;
if SeparateFiles then
FFileSuffix := '.' + IntToStr(FCurrentPage)
else
FFileSuffix := '';
SavedFileName := ChangeFileExt(FileName, FFileSuffix + '.bmp');
//call your actual printing routine here. Be sure your the control returns here when the bitmap file is not needed anymore.
PrintBitmapFile(SavedFileName);
try
DeleteFile(SavedFileName);
except
//handle exceptions here if you want to continue if the file is not deleted
//or let the exception fly to stop the printing process.
//you may want to add the file to a queue for later deletion
end;
end;
function TBMPPrintExport.Start: Boolean;
begin
inherited;
FCurrentPage := 0;
end;
procedure TBMPPrintExport.StartPage(Page: TfrxReportPage; Index: Integer);
begin
inherited;
Inc(FCurrentPage);
end;
В рабочем коде вы захотите переопределить другие методы для инициализации и завершения работы принтера, очистки и т. Д.
Код основан на реализации TfrxCustomImageExport в FastReport v4.0, специально для нумерации страниц и имен файлов. Может потребоваться корректировка для других версий FastReport.