Expand description
Professional PDF report engine for structural engineering calculations.
ses-pdf compiles a structured document model into a publication-quality PDF
using the Typst typesetting engine under the hood.
Reports can contain:
- Engineering equations with Typst math notation
- Calculation blocks (formula → substitution → numeric result)
- Data tables with shaded headers
- Line, bar, scatter, and P-M interaction charts (vector SVG)
- User-supplied images and SVG figures
- Cover page, section numbering, headers, footers, and page numbers
- Drawing sheets with Arch paper sizes, landscape orientation, and title blocks
§Quick start
use ses_pdf::*;
let pdf_bytes = Report::new(ReportMetadata {
project_name: "Grid B5 Beam".into(),
project_number: "2025-001".into(),
prepared_by: "SES Engineering".into(),
checked_by: None,
date: "March 14, 2025".into(),
paper: PaperSize::Letter,
orientation: Orientation::Portrait,
})
.section(
Section::new("Moment Capacity")
.text("Nominal moment capacity per ACI 318-19 Section 22.2.")
.equation(Equation::display("phi M_n = phi dot A_s dot f_y dot (d - a/2)"))
.calc(
CalcBlock::new("Nominal Moment Capacity")
.formula("M_n = A_s f_y (d - a/2)")
.substitution("M_n = (0.60)(60)(14.5 - 1.25)")
.result("M_n = 477 \"kip-in\"")
.build()
.unwrap(),
),
)
.render()
.unwrap();
std::fs::write("report.pdf", pdf_bytes).unwrap();§Drawing sheets
Attach a TitleBlock and choose an Arch paper size with landscape orientation
for structural drawing sheets. Page chrome switches to a sheet border and title
block footer instead of calculation-report headers.
Supported Arch sizes: PaperSize::ArchA … PaperSize::ArchE, PaperSize::ArchE1.
§Math notation
Equations use Typst math syntax, not LaTeX:
| LaTeX | Typst |
|---|---|
\phi | phi |
\frac{a}{b} | a/b |
\sqrt{x} | sqrt(x) |
\times | times |
Display math \[ ... \] | $ ... $ (spaces inside) |
A_{cv} (multi-letter sub) | A_"cv" |
See the Typst math documentation for the full reference.
Re-exports§
pub use chart::BarChart;pub use chart::BarSeries;pub use chart::Chart;pub use chart::ChartColor;pub use chart::DemandPoint;pub use chart::LineChart;pub use chart::LineSeries;pub use chart::PmInteractionDiagram;pub use chart::ScatterChart;pub use chart::ScatterSeries;pub use element::CalcBlock;pub use element::CalcBlockBuilder;pub use element::CalcStatus;pub use element::CellAlign;pub use element::CellValue;pub use element::ColumnSpec;pub use element::ColumnWidth;pub use element::Equation;pub use element::Figure;pub use element::HeadingLevel;pub use element::ImageFormat;pub use element::Table;pub use element::TableBuilder;
Modules§
Structs§
- Cover
Page - Report
- Report
Metadata - Section
- Title
Block - Drawing-sheet title block shown in the page footer chrome.
Enums§
- Orientation
- Paper
Size - PdfError
- All errors that can occur during report compilation.