Return a tidy tibble of the pictures Docling detected, with their captions
and page numbers. When image_dir is supplied and the document was converted
with images = TRUE, each picture is written to disk and its path returned.
Arguments
- x
A
docling_documentfromdocling_convert().- image_dir
Optional directory to save picture images into. Created if it does not exist. Requires
docling_convert()to have been called withimages = TRUE; otherwise image data is unavailable andimage_pathisNAwith a warning.- format
Image file format when saving, for example
"png"(default) or"jpeg".
Value
A tibble::tibble with one row per figure and columns:
figure_id— 1-based index.caption— caption text (empty string if none).page— page number the figure appears on (NAif unknown).image_path— path to the saved image, orNAif not saved.
Examples
if (FALSE) { # \dontrun{
doc <- docling_convert("paper.pdf", images = TRUE)
figs <- docling_figures(doc, image_dir = "figures")
figs$image_path
} # }