I am exporting generated FPReport to PDF, but I have problems with QRcode - sometimes there are some glitches around and in the QRCode. Example is attached PDF (generated from attached program) and image (from more complex report).
These glitches somehow depends on other report elements. I also noticed that when I turn on 'Use Heaptrc unit (check for mem-leaks)', glitches disappear.
In my program they don't appear on first run of the report, but on 2nd and subsequent runs of report.
Am I using TFPReportQRCode in the wrong way or is there some bug in this class?
This is happening under Lazarus 3.4 under Windows 11, but also with Lazarus 2.2.4 on Android (LAMW).
Here is the test program (I attached Lazarus project):
program project1;
uses
SysUtils, LCLIntf, fpreport, fpreportqrcode, fpreportpdfexport;
var report: TFPReport;
page: TFPReportPage;
header: TFPReportPageHeaderBand;
title: TFPReportTitleBand;
exporter: TFPReportExporter;
qrCode, qrCode2: TFPReportQRCode;
begin
if PaperManager.PaperCount = 0 then
PaperManager.RegisterStandardSizes;
report := TFPReport.Create(nil);
try
page := TFPReportPage.Create(report);
page.Orientation := poPortrait;
page.PageSize.PaperName := 'A4';
page.Margins.Left := 20;
page.Margins.Top := 20;
page.Margins.Right := 20;
page.Margins.Bottom := 20;
page.Font.Name := 'LiberationSans';
header := TFPReportPageHeaderBand.Create(page);
header.Layout.Height := 50;
qrCode := TFPReportQRCode.Create(header);
qrCode.Layout.Top := 0;
qrCode.Layout.Left := 15;
qrCode.Layout.Width := 38;
qrCode.Layout.Height := 38;
qrCode.Value := 'abcde12345abcde12345abcde12345abcde12345abcde12345';
qrCode.Center := True;
title := TFPReportTitleBand.Create(page);
title.Layout.Height := 50;
qrCode2 := TFPReportQRCode.Create(header);
qrCode2.Layout.Top := 0;
qrCode2.Layout.Left := 60;
qrCode2.Layout.Width := 38;
qrCode2.Layout.Height := 38;
qrCode2.Value := 'abcde12345abcde12345abcde12345abcde12345abcde12345';
qrCode2.Center := True;
report.RunReport;
exporter := TFPReportExportPDF.Create(nil);
exporter.SetFileName('test.pdf');
report.RenderReport(exporter);
finally
exporter.Free;
report.Free;
end;
OpenDocument('test.pdf');
end.