pub struct PreciseLayout {
pub version: String,
pub presentation_type: String,
pub target_format: String,
pub page_size: PrecisePageSize,
pub content_hash: String,
pub generated_at: DateTime<Utc>,
pub page_template: Option<PageTemplate>,
pub pages: Vec<PrecisePage>,
pub fonts: HashMap<String, FontMetrics>,
}Expand description
Precise layout for a specific page format.
Precise layouts store exact positions for all elements, ensuring identical rendering across different implementations. This is required for documents in FROZEN or PUBLISHED state.
Fields§
§version: StringFormat version.
presentation_type: StringPresentation type (always “precise”).
target_format: StringTarget page format name (e.g., “letter”, “a4”, “legal”, “custom”).
page_size: PrecisePageSizeExact page dimensions.
content_hash: StringHash of the semantic content layer when this layout was generated. Used to detect staleness when content changes. Note: The document ID covers semantic content only; this layout hash can be included in scoped signatures for layout attestation.
generated_at: DateTime<Utc>Timestamp when this layout was generated.
page_template: Option<PageTemplate>Optional page template for headers/footers/margins.
pages: Vec<PrecisePage>Page definitions with precise element positions.
fonts: HashMap<String, FontMetrics>Font metrics for exact text reproduction.
Implementations§
Source§impl PreciseLayout
impl PreciseLayout
Sourcepub fn new_letter(content_hash: impl Into<String>) -> Self
pub fn new_letter(content_hash: impl Into<String>) -> Self
Create a new precise layout for US Letter format.
Sourcepub fn new_a4(content_hash: impl Into<String>) -> Self
pub fn new_a4(content_hash: impl Into<String>) -> Self
Create a new precise layout for A4 format.
Sourcepub fn new_legal(content_hash: impl Into<String>) -> Self
pub fn new_legal(content_hash: impl Into<String>) -> Self
Create a new precise layout for US Legal format.
Sourcepub fn is_stale(&self, current_content_hash: &str) -> bool
pub fn is_stale(&self, current_content_hash: &str) -> bool
Check if this layout is stale (content has changed).
Sourcepub fn add_page(&mut self, page: PrecisePage)
pub fn add_page(&mut self, page: PrecisePage)
Add a page to this layout.
Sourcepub fn with_template(self, template: PageTemplate) -> Self
pub fn with_template(self, template: PageTemplate) -> Self
Set the page template.
Sourcepub fn with_font(self, name: impl Into<String>, metrics: FontMetrics) -> Self
pub fn with_font(self, name: impl Into<String>, metrics: FontMetrics) -> Self
Add font metrics.
Trait Implementations§
Source§impl Clone for PreciseLayout
impl Clone for PreciseLayout
Source§fn clone(&self) -> PreciseLayout
fn clone(&self) -> PreciseLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more