NativeElixirPdfUtilities.HtmlToPdf.PageGeometry (native_elixir_pdf_utilities v0.12.0)
View SourceShared page-option cascade helpers and vertical layout-box geometry.
This module parses page-size and margin inputs into the renderer's canonical geometry values. The HTML validator remains the semantic authority that decides whether those canonical values are valid for an operation.
Summary
Functions
Returns the vertical {top, bottom} bounds for a drawable layout box.
Returns a scalar for uniform margins and the four-sided map for asymmetric margins.
Converts an applicable CSS page-margin value to a renderer margin value.
Converts an applicable CSS page-size descriptor to a renderer page-size value.
Merges a later page-margin declaration over an earlier declaration.
Merges extracted page options while cascading partial margin longhands by side.
Resolves a nonnegative renderer margin into top, right, bottom, and left points.
Resolves a renderer page-size value to a positive {width, height} point tuple.
Returns whether a four-sided margin leaves positive printable page geometry.
Types
@type orientation() :: :portrait | :landscape
@type page_size_input() :: page_size_name() | :"jis-b5" | :"jis-b4" | {page_size_name() | :"jis-b5" | :"jis-b4", orientation()} | {orientation(), page_size_name() | :"jis-b5" | :"jis-b4"} | {number(), number()} | String.t()
@type page_size_name() ::
:a5 | :a4 | :a3 | :b5 | :b4 | :jis_b5 | :jis_b4 | :letter | :legal | :ledger
Functions
Returns the vertical {top, bottom} bounds for a drawable layout box.
Text bounds account for both the font ascent and the full line height so all rendering stages agree about the vertical space occupied by a line.
Returns a scalar for uniform margins and the four-sided map for asymmetric margins.
Converts an applicable CSS page-margin value to a renderer margin value.
@spec css_page_size_option(String.t()) :: page_size_input() | nil
Converts an applicable CSS page-size descriptor to a renderer page-size value.
Merges a later page-margin declaration over an earlier declaration.
Merges extracted page options while cascading partial margin longhands by side.
Resolves a nonnegative renderer margin into top, right, bottom, and left points.
Resolves a renderer page-size value to a positive {width, height} point tuple.
Returns whether a four-sided margin leaves positive printable page geometry.