Convenience wrapper that takes a tibble in the shape
pdf_path_segments() returns and replays it as a series of
appender calls on obj. Useful when you've read a path with
pdf_path_segments(), edited the rows in R, and want to append
the modified geometry to a fresh path object.
Arguments
- obj
A
pdfium_objof type"path". Parent doc must be readwrite.- segments
A tibble with at minimum the columns
segment_type(character),x,y(numeric), and optionallyclose_figure(logical). Matches thepdf_path_segments()output exactly so a reader → edit → writer round-trip is a one-liner.
Details
Segment dispatch by the segment_type column:
"moveto"→pdf_path_move_to()with(x, y)."lineto"→pdf_path_line_to()with(x, y)."bezierto"→ cubic Bezier. PDFium's reader surfaces each cubic curve as three consecutivebeziertorows (two control points then the endpoint); this wrapper buffers two rows and emits a singlepdf_path_bezier_to()call on the third.
Any row whose close_figure column is TRUE triggers a
pdf_path_close() after its segment.