Bounding-box math and coordinate conversion.
The public coordinate system has a top-left origin (matching Python
pdfplumber): a bounding box is [x0 top x1 bottom] in PDF user-space points
with x0 <= x1 and top <= bottom. PDFBox works in a bottom-left origin, so
conversion happens here and nowhere else. All extraction code must use these
helpers rather than open-coding the arithmetic.
Bounding-box math and coordinate conversion. The public coordinate system has a top-left origin (matching Python `pdfplumber`): a bounding box is `[x0 top x1 bottom]` in PDF user-space points with `x0 <= x1` and `top <= bottom`. PDFBox works in a bottom-left origin, so conversion happens here and nowhere else. All extraction code must use these helpers rather than open-coding the arithmetic.
(center [x0 top x1 bottom])Midpoint [x y] of a bbox.
Midpoint `[x y]` of a bbox.
(contains? [ox0 otop ox1 obot] [ix0 itop ix1 ibot])True when inner lies entirely within outer (boundaries inclusive).
True when `inner` lies entirely within `outer` (boundaries inclusive).
(flip-y page-height y)Convert a single y between bottom-origin and top-origin about page-height.
Self-inverse: (flip-y h (flip-y h y)) == y.
Convert a single y between bottom-origin and top-origin about `page-height`. Self-inverse: `(flip-y h (flip-y h y)) == y`.
(intersection [ax0 atop ax1 abot] [bx0 btop bx1 bbot])Overlap bbox of a and b, or nil when they do not overlap with positive area.
Overlap bbox of `a` and `b`, or nil when they do not overlap with positive area.
(intersects? [ax0 atop ax1 abot] [bx0 btop bx1 bbot])True when a and b overlap with positive area. Edge-touching boxes (zero
overlap area) are not considered intersecting.
True when `a` and `b` overlap with positive area. Edge-touching boxes (zero overlap area) are not considered intersecting.
(pdfbox-rect->bbox page-height x y w h)Convert a PDFBox lower-left rectangle (x y w h) on a page of page-height
into a public top-left bbox [x0 top x1 bottom].
Convert a PDFBox lower-left rectangle `(x y w h)` on a page of `page-height` into a public top-left bbox `[x0 top x1 bottom]`.
(within? [x0 top x1 bottom] [x y])True when point [x y] falls inside bbox (boundaries inclusive).
True when point `[x y]` falls inside `bbox` (boundaries inclusive).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |