Skip to contents

Returns the smallest rectangle, in PDF point coordinates, that contains all visible parts of obj. The bounds are in the page's own coordinate system, i.e. origin at the bottom-left of the un-rotated media box (matching pdf_page_size()). Note that the bounds are not adjusted for the page's rotation; consult pdf_page_rotation() when comparing positions across rotated pages.

Usage

pdf_obj_bounds(obj)

Arguments

obj

A pdfium_obj from pdf_page_objects().

Value

A named numeric vector with elements left, bottom, right, top. Width is right - left, height is top - bottom.

Examples

fixture <- system.file("extdata", "fixtures", "shapes.pdf",
  package = "pdfium"
)
if (nzchar(fixture)) {
  doc <- pdf_doc_open(fixture)
  p <- pdf_page_load(doc, 1)
  objs <- pdf_page_objects(p)
  pdf_obj_bounds(objs[[1]])
  pdf_page_close(p)
  pdf_doc_close(doc)
}