ses-pdf
Professional PDF report engine for structural engineering calculations, written in Rust.
Compiles a structured document model into a publication-quality PDF using the Typst typesetting engine under the hood. Reports can contain:
- Equations — Typst math notation, inline or display
- Calculation blocks — formula → substitution → numeric result, with status indicators
- Tables — shaded alternating rows and a styled header
- Charts — line, bar, scatter, and P-M interaction diagrams (vector SVG)
- Figures — user-supplied PNG, JPEG, or SVG images
- Cover page — title, logo, project info table, revision history
- Professional layout — page numbers, header/footer, section numbering; Letter/Tabloid/A4 and Arch A–E / E1
- Drawing sheets — landscape Arch sizes with sheet border and title block (sheet number, scale, revisions)
Installation
[]
= "0.2"
Requires Rust 1.92 or later.
Quick start
use *;
let pdf_bytes = new
.cover
.section
.section
.render?;
write?;
Chart types
| Variant | Use case |
|---|---|
Chart::Line(LineChart) |
Load-deflection, time series, any x-y data |
Chart::Bar(BarChart) |
Comparison of quantities across categories |
Chart::Scatter(ScatterChart) |
Test data vs. prediction, correlation plots |
Chart::PmInteraction(PmInteractionDiagram) |
Column/wall P-M capacity envelope with demand points |
Math notation
Equations use Typst math syntax, not LaTeX:
| LaTeX | Typst |
|---|---|
\phi |
phi |
\frac{a}{b} |
a/b |
\sqrt{x} |
sqrt(x) |
\times |
times |
A_{cv} (multi-letter subscript) |
A_"cv" |
Display math \[ ... \] |
$ ... $ (spaces inside the $) |
Full reference: typst.app/docs/reference/math
Calculation blocks
new
.formula
.substitution
.result
.status // Ok | Governs | DoesNotGovern
.build?
Status controls the left border color: blue (Ok), green (Governs), gray (DoesNotGovern).
Drawing sheets
Use Arch paper sizes with landscape orientation and a TitleBlock for structural
drawing sheets. Attaching a title block switches page chrome to a sheet border and
footer title block (instead of calculation-report headers).
PaperSize |
Typst name | Size |
|---|---|---|
ArchA |
arch-a |
9 × 12 in |
ArchB |
arch-b |
12 × 18 in |
ArchC |
arch-c |
18 × 24 in |
ArchD |
arch-d |
24 × 36 in |
ArchE |
arch-e |
36 × 48 in |
ArchE1 |
arch-e1 |
30 × 42 in |
new
.title_block
/* .section(... plan figure, schedules ...) */
.render?;
License
MIT