Skip to main content

Crate reports_web

Crate reports_web 

Source
Expand description

§reports-web

Reports.Web for Rust: build print data (PREPEJ) from report definitions (.prepdj) designed in the browser, and render PDF with the Reports.Web engine (C++ WebAssembly, Docker image ghcr.io/reportsweb/engine).

帳票定義(.prepdj)に値を入れて印刷データ(PREPEJ)を作り、Reports.Web エンジンで PDF にします。

use reports_web::{PrintData, ReportsWebEngine};
let definition: serde_json::Value = serde_json::from_str(&std::fs::read_to_string("report.prepdj")?)?;
let mut print_data = PrintData::new();
print_data.set_definition(&definition)?.page_start()?;
print_data.set_value("Title", "あっという間に帳票出力")?.page_end()?;
let pdf = ReportsWebEngine::new("http://127.0.0.1:3107")?.render_pdf(&print_data).await?;
std::fs::write("report.pdf", pdf)?;

Trial build: output carries a red “SAMPLE” mark until the purchased license file is configured in the engine. https://www.pao.ac/reports.web/

Structs§

EngineError
Error from the Reports.Web engine. status is the HTTP status, or None for transport errors.
PrintData
Framework-independent builder for the shared PREPEJ print-document format. One instance belongs to one report/request; input definitions and output are cloned.
ReportsWebEngine
Async client for the Reports.Web engine.

Constants§

FORMAT
MAX_BYTES
Largest print data and PDF accepted, in bytes (32 MiB).
VERSION

Functions§

assert_definition