Printing a large number of pictures
Hello,
I am trying to print a large number of bitmap icons, but report throws "Canvas does not allow drawing" exception and freezes after hundreds of lines.
unit Main;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, frxClass;
type
TMainForm = class(TForm)
Report: TfrxReport;
btnShowPreview: TButton;
edtLines: TEdit;
Label1: TLabel;
procedure btnShowPreviewClick(Sender: TObject);
procedure ReportManualBuild(Page: TfrxPage);
procedure FormCreate(Sender: TObject);
private
procedure SetText(Name: String; Text: String);
procedure SetIcon(Name: String; Icon: TGraphic);
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
uses
StockIconUtil;
procedure TMainForm.btnShowPreviewClick(Sender: TObject);
begin
Report.ShowReport;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
Randomize;
end;
procedure TMainForm.ReportManualBuild(Page: TfrxPage);
var
Line, Column: Integer;
begin
for Line := 1 to StrToInt(edtLines.Text) do
begin
SetText('meLine', 'Line ' + IntToStr(Line));
for Column := 1 to 33 do
SetIcon('Picture' + IntToStr(Column), TStockIcon.GetBmp(Random(100)));
Report.Engine.ShowBandByName('IkonsBand');
end;
end;
procedure TMainForm.SetText(Name: String; Text: String);
var
C: TfrxComponent;
begin
C := Report.FindObject(Name);
TFrxMemoView(C).Memo.Text := Text;
end;
procedure TMainForm.SetIcon(Name: String; Icon: TGraphic);
var
C: TfrxComponent;
begin
C := Report.FindObject(Name);
TFrxPictureView(C).Picture.Assign(Icon);
end;
end.
Thanks for any help.
Dominik
Comments
What version of FR do you use?
Try to set TfrxReport.EngineOptions.UseFileCache to True
Try to test latest FR 6.6.16 too
I am using FastReport 5.0. I've tried it in FastReport 6.0 Trial as well.
UseFileCache option or other Cashe option and Preview options didn't help me.
Create small demo project and send it to support@fast-report.com