Examples
Three lines to a PDF.
Every snippet here is the code path the CLI itself runs — nothing is simplified for the page.
Integrating is three lines
Reads the .rpt, lays it out from the rows saved inside it, and writes the PDF. One package reference, one transitive dependency.
ReportModel model = ReportModelBuilder.FromRpt("report.rpt");
PaginatedDocument doc = Paginator.Paginate(model, new PdfTextMeasurer());
PdfRenderer.RenderToFile(doc, model, "out.pdf");
Connect to a database and bind a parameter
The same report file against live rows. Reporter builds the report’s own query — links, join order, pruning, and the record selection pushed down to the server — and binds every parameter rather than interpolating it.
# The connection string is the value of a named environment variable — it never
# appears on the command line, in shell history, or in any log Reporter writes.
export DB_CONNECTION="Host=db.internal;Database=appdb;Username=reports"
reporter render report.rpt -o out.pdf \
--db postgres --connection-ref DB_CONNECTION \
--param RECORD_ID=100234 \
--locale en-GB
IDbProvider provider = new PostgresProvider(); // or OracleProvider
string connection = Environment.GetEnvironmentVariable("DB_CONNECTION")!;
ReportModel model = ReportModelBuilder.FromRpt("report.rpt");
// Parameters arrive as text and are coerced to each parameter's declared type.
IReadOnlyDictionary<string, FormulaValue> parameters = ParameterBinding.Resolve(
model,
new Dictionary<string, string> { ["RECORD_ID"] = "100234" });
// The row source builds the report's own query: links, join order, pruning, and the
// record selection pushed down to the server. Parameters bind, never interpolate.
DbRowSource rows = new DbRowSource(
() => provider.Open(connection),
provider.Dialect,
provider.PrepareCommand,
provider.ReadValue);
model = ReportDataBinder.Bind(model, rows, parameters, "report.rpt");
PaginatedDocument doc = Paginator.Paginate(model, new PdfTextMeasurer(), Locale.EnGb, parameters);
PdfRenderer.RenderToFile(doc, model, "out.pdf");
Mark an evaluation run
The demo on this site is exactly this call. A licensed run passes no watermark and the output carries no band.
# Every page gets a diagonal "UNLICENSED EVALUATION COPY" band. A licensed run
# draws nothing at all — the flag is the only difference in the output.
reporter render report.rpt -o out.pdf --watermark
The report, as an open definition
The other half of the tool. convert reads the proprietary .rpt and writes a JSON report definition — sections, objects, geometry in twips, fonts, formulas, grouping and record selection. No SAP runtime is involved, and the format is one you can read, diff and edit.
reporter convert report.rpt -o report.json
{
"RecordSelection": "{POLICY.POL_NO_GROUP} = {?AUTO_POLICYNUMBER}",
"Formulas": [
{ "Name": "Section_Visibility", "ResultType": "Boolean", "Text": "{POLICY.POL_TYPE} <> 'CI'" }
],
"Groups": [
{ "ConditionField": "POLICY.POL_NO_GROUP", "Direction": "NoSortOrder" }
],
"Areas": [
{
"Kind": "Detail",
"Sections": [
{
"Height": 240,
"Objects": [
{
"Name": "Field22",
"Kind": "Field",
"Bounds": { "Left": 598, "Top": 0, "Width": 9737, "Height": 180 },
"FontName": "Arial",
"FontSizePt": 9,
"FontBold": false,
"CanGrow": true,
"DataSource": "{POLICY_PREMIUMS.POP_WORDING}"
}
]
}
]
}
]
}
Reporter package carries the parser, the model and the engine, and depends only on PDFsharp — a database driver is not forced on a consumer who does not need one. DbRowSource takes any IDbProvider, so the PostgreSQL and Oracle providers are separate assemblies. They ship in Reporter-libraries-<version>.zip rather than inside the package. That zip and the package are not a public download — ask us for a link. The Oracle one is on the fully managed driver, with no Instant Client to install.