An axis-aligned rectangle in PDF user-space coordinates.
PDF user space has a bottom-left origin with y increasing upward, so the
origin {x, y} is the bottom-left corner (the minimum x/y); the top edge
is y + height and the right edge is x + width. width and height are
always non-negative.
Unbounded values
A float the PDF drives past the single-precision range arrives as the
largest finite value of that sign, about 3.4e38, and one it leaves
undefined as 0.0. No field ever holds an infinity or a NaN. Every float
on an extracted struct follows this rule, whichever module carries it.
Rotated pages
to_display_frame/3 and to_user_space/3 move rectangles between raw user
space and the displayed frame. See Rotated pages and extracted
geometry for
which extractor boxes need conversion.
Summary
Functions
Maps a rectangle in raw, unrotated user space into the displayed frame of a
page turned by rotation.
Maps a rectangle in the displayed frame of a page turned by rotation back
into raw, unrotated user space.
Types
Functions
@spec to_display_frame(t(), PdfElixide.Document.Page.rotation(), t()) :: t()
Maps a rectangle in raw, unrotated user space into the displayed frame of a
page turned by rotation.
Pass the page's PdfElixide.Document.Page.rotation/1 and raw, unswapped
PdfElixide.Document.Page.media_box/1. The result is normalized,
and to_user_space/3 is the inverse. Only 0, 90, 180 and 270 are
accepted; another rotation raises FunctionClauseError.
iex> box = %PdfElixide.Geometry.Rect{x: 10.0, y: 20.0, width: 612.0, height: 792.0}
iex> rect = %PdfElixide.Geometry.Rect{x: 82.0, y: 740.0, width: 100.0, height: 24.0}
iex> PdfElixide.Geometry.Rect.to_display_frame(rect, 90, box)
%PdfElixide.Geometry.Rect{x: 730.0, y: 460.0, width: 24.0, height: 100.0}
@spec to_user_space(t(), PdfElixide.Document.Page.rotation(), t()) :: t()
Maps a rectangle in the displayed frame of a page turned by rotation back
into raw, unrotated user space.
This is the inverse of to_display_frame/3 and takes the same raw media box.
Convert only boxes known to be in the displayed frame; Telling which frame a
box is in explains
how to identify them.