Lazarus and Free Pascal
Report Manager is available for Lazarus and Free Pascal as three packages: the reporting
engine with PDF export, the LCL preview and printing, and the visual report designer, which you can
embed in your own applications. The components are installed on the Reportman page of the
component palette. The packages run on Windows and Linux and use the same .rep report
files as the Delphi components, the .NET libraries and the Report Manager Designer.
- Run reports and export them to PDF (also PDF/A-3 with embedded files), SVG, HTML, CSV, plain text and the native metafile format, with or without a graphical interface.
- Preview and print from LCL applications, with the same page layout as the PDF output.
- Embed the report designer (
TRpDesignerLCL) so your users can change reports without changing your application, including the AI assistants for report design, SQL and expressions. - Complex text shaping and bidirectional text on both platforms, see bidirectional text and complex scripts.
The Linux desktop designer is built from these same packages.
Requirements
- Lazarus 3.0 or later with Free Pascal 3.2.2 (tested with Lazarus 3.0 and 4.8).
- Windows (win32/win64 widgetset) or Linux (Qt 6, Qt 5 or GTK2 widgetset); tested on 64-bit systems.
- The ZeosDBO package (
zcomponent8.0) for database access. The Online Package Manager installs it for you. - From Lazarus itself: LCL, Printer4Lazarus, DateTimeCtrls, TurboPowerIPro and SynEdit.
- On Linux, at run time: FreeType, fontconfig, HarfBuzz and ICU (installed on any desktop; see the dependencies of the Linux designer).
The packages
| Package | Contents | Requires |
|---|---|---|
reportman_rtlpackages/fpc/ |
Non-visual engine: report model, expression evaluator, data access and the PDF, SVG, HTML, CSV, text and metafile output. | FCL, zcomponent |
reportman_lclpackages/fpc_lcl/ |
LCL runtime: TLCLReport, preview window, page setup, parameters and printing. |
reportman_rtl, LCL, Printer4Lazarus, DateTimeCtrls |
reportman_designlclpackages/fpc_lcl/ |
The embeddable visual designer TRpDesignerLCL, with the AI assistants. |
reportman_rtl, reportman_lcl, LCL, TurboPowerIPro, SynEdit |
The three packages are run and design time: they register their components on the palette and your applications use the same units at run time.
Install from the Online Package Manager
- In Lazarus, open Package → Online Package Manager.
- Find Report Manager (category Reporting), check it and click Install.
- Accept the installation of ZeosDBO when the package manager asks for it.
- Let Lazarus rebuild and restart the IDE. The components appear on the Reportman page of the component palette.
Install from the source code
- Get the source code from GitHub or SourceForge.
- Install ZeosDBO 8.0 (from the Online Package Manager, or its
zcomponent.lpk). - Open
packages/fpc/reportman_rtl.lpkand click Compile. - Open
packages/fpc_lcl/reportman_lcl.lpkand choose Use → Install. - Open
packages/fpc_lcl/reportman_designlcl.lpkand choose Use → Install; Lazarus rebuilds the IDE.
The packages can also be built from the command line with lazbuild, in the same order
(packages/fpc/build_fpc.bat on Windows, build_fpc.sh on Linux).
Components on the palette
| Component | Package | Use |
|---|---|---|
TLCLReport | reportman_lcl | Loads a report, previews or prints it, and saves it to PDF, text or metafile. |
TRpPreviewControl | reportman_lcl | Preview control to place in your own forms. |
TPDFReport | reportman_rtl | Runs a report and writes the PDF file, without any user interface (console programs, services, web servers). |
TRpDesignerLCL | reportman_designlcl | Opens the report designer for a report and saves the result. |
TRpRulerLCL | reportman_designlcl | The ruler control of the designer. |
TRpEvaluator | reportman_rtl | The expression evaluator of the engine, see expression evaluator. |
TRpAlias | reportman_rtl | Assigns your own open datasets to the datasets of a report. |
TRpTranslator, TRpLastUsedStrings, TRpMaskEdit | reportman_rtl, reportman_lcl | Helpers: translations, most recently used lists and masked input. |
Examples
Preview, print or export a report
Drop a TLCLReport on a form:
procedure TForm1.ButtonPreviewClick(Sender: TObject);
begin
LCLReport1.Filename := 'sample4.rep';
LCLReport1.Preview := True; // False prints the report
LCLReport1.Execute;
end;
procedure TForm1.ButtonPDFClick(Sender: TObject);
begin
LCLReport1.Filename := 'sample4.rep';
LCLReport1.SaveToPDF('sample4.pdf');
end;
PDF from a program without user interface
A console program that only needs the reportman_rtl package (add it in
Project → Project Inspector → Add → New Requirement). On Linux,
cthreads and cwstring must be the first units, as in any Free Pascal
program that uses threads and Unicode strings:
program reptopdf;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}cthreads, cwstring,{$ENDIF}
Classes, SysUtils, rppdfreport;
var
Pdf: TPDFReport;
begin
Pdf := TPDFReport.Create(nil);
try
Pdf.Filename := 'sample4.rep';
Pdf.PDFFilename := 'sample4.pdf';
Pdf.Execute;
finally
Pdf.Free;
end;
end.
Let your users edit the reports
Drop a TRpDesignerLCL on a form. Execute opens the designer and returns
True when the user accepts the changes, which are saved to the file (or, with the
OnSave event or SaveToStream, wherever you keep your reports, for example a
database):
procedure TForm1.ButtonDesignClick(Sender: TObject);
begin
RpDesignerLCL1.Filename := 'sample4.rep';
if RpDesignerLCL1.Execute then
ShowMessage('The report has been saved');
end;
Data access
Reports connect to their databases with the same connection definitions as the designer
(dbxconnections, see database connections): Zeos
connections for Firebird, PostgreSQL, MySQL/MariaDB, SQLite and other databases, and the
Reportman DB Agent driver, which runs the queries on a remote database through the Hub
(api.reportman.es) without opening ports or a VPN. You can also assign your own open
datasets to the report with TRpAlias.
Notes
- HTTPS (the AI assistants and the Reportman DB Agent driver) uses OpenSSL, loaded at run
time. On Windows, distribute
libssl-3-x64.dllandlibcrypto-3-x64.dll(libssl-3.dllandlibcrypto-3.dllfor 32 bits) next to your executable; on Linux the systemlibssland CA certificates are used. Without OpenSSL, only the HTTPS connections fail. - SQL editor of the designer: on Windows it is the Monaco editor (it needs the Microsoft Edge WebView2 runtime, included in current Windows 10 and 11); on Linux, a native editor with schema completion and the AI inline suggestion. See the Linux designer for the differences.
- The engine source is shared with the Delphi components: bug fixes reach both.