Qpdf.Dimensions (qpdf v0.2.0)

Copy Markdown View Source

Parses page geometry, bounding boxes, dimensions, orientation, and standard paper sizes from qpdf JSON structural metadata.

Paper size matching allows a 0.5% deviation on each dimension. Cyclic page trees or inheritance chains of more than 256 objects return an error.

Summary

Functions

Parses page dimensions from decoded qpdf v1 JSON data.

Types

orientation()

@type orientation() :: :portrait | :landscape | :square

page_dim()

@type page_dim() :: %{
  page: pos_integer(),
  width: float(),
  height: float(),
  rotation: non_neg_integer(),
  orientation: orientation(),
  paper_size: String.t() | nil,
  box: %{media: [float()], crop: [float()]}
}

Functions

parse(data, page_spec)

@spec parse(map(), :all | integer() | Range.t() | list()) ::
  {:ok, page_dim() | [page_dim()]} | {:error, any()}

Parses page dimensions from decoded qpdf v1 JSON data.