Skip to contents

Returns the RGBA fill color of obj. Channels are integers in [0, 255]. When PDFium reports that the object has no fill set (e.g. a stroke-only path), all four channels are NA.

Usage

pdf_path_fill(obj)

Arguments

obj

A pdfium_obj of type "path" (from pdf_page_objects()).

Value

A named numeric vector c(red, green, blue, alpha) of 0-255 channel values, or all-NA when no fill is set.

Examples

fixture <- system.file("extdata", "fixtures", "shapes.pdf",
  package = "pdfium"
)
if (nzchar(fixture)) {
  doc <- pdf_doc_open(fixture)
  p <- pdf_page_load(doc, 1)
  path_obj <- Filter(\(o) o$type == "path", pdf_page_objects(p))[[1]]
  pdf_path_fill(path_obj)
  pdf_page_close(p)
  pdf_doc_close(doc)
}