Returns the RGBA stroke color and stroke width of obj as a flat
named numeric vector. Color channels are integers in [0, 255];
width is in PDF points. When PDFium reports that the object has
no stroke set, every value is NA.
Arguments
- obj
A
pdfium_objof type"path"(frompdf_page_objects()).
Value
A named numeric vector with elements red, green,
blue, alpha (0-255 channels) and width (PDF points).
All-NA when no stroke is set.
Details
The returned shape mirrors pdf_path_fill() (a flat named
vector). The downstream tibble columns in pdf_extract_paths()
(stroke_red, stroke_green, stroke_blue, stroke_alpha,
stroke_width) are built by prefixing the names of this vector.
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_stroke(path_obj)
pdf_page_close(p)
pdf_doc_close(doc)
}