Placement
Rect, PageSelector, Placement, and resolve_placements — the page-placement DSL, field by field
The placement DSL pairs a page selector (which pages) with a rectangle (where on the page).
Selectors resolve against the document's real page count at sign time, so ODD, L, 2-5,
"1,3,5-7,L" etc. work without listing every page. The same page may carry several placements with
different boxes — that "multi-box per page" case falls out naturally.
Rect
A signature-box rectangle in PDF user space (points, bottom-left origin), with named corners so the four numbers can't be transposed by accident.
Prop
Type
Prop
Type
Rect implements From<[i64; 4]> (and the reverse, From<Rect> for [i64; 4]), so
.place(sel, [350, 60, 560, 160]) and .place(sel, Rect::new(350, 60, 560, 160)) are equivalent —
pick whichever reads better. It also implements From<[f64; 4]>, which rounds to the nearest
point rather than truncating (559.9 → 560, not 559) — handy when a rect comes from a
floating-point layout computation.
PageSelector
Which pages a Placement targets.
Prop
Type
Prop
Type
Ranges are capped at page_count internally, so an unbounded a-b (e.g. "1-999999" on a 3-page
document) cannot allocate a huge vector — it just resolves to the pages that exist.
Placement
A signature box ([x1, y1, x2, y2], PDF points, bottom-left origin) placed on the pages chosen by
pages.
Prop
Type
Prop
Type
Placement also implements From<(u32, [i64; 4])>, constructing a PageSelector::Page(page)
placement directly from a (page, rect) tuple.
let p1 = Placement::new(PageSelector::Last, [350, 60, 560, 160]);
let p2 = Placement::parse("1,3,5-7,L", [40, 40, 200, 100])?;resolve_placements
pub fn resolve_placements(placements: &[Placement], page_count: u32) -> Vec<(u32, [i64; 4])>Flatten placements to the (page, rect) list the signer stamps, resolving every selector against
page_count. Order follows the placements list (so Method::MultiChained's first revision is the
first resolved entry); within a placement, pages ascend. Exact (page, rect) duplicates are
dropped, but the same page with different boxes is kept — this is how one page ends up with
multiple signature widgets.