From 9ffa48a0ec32443adff9d54660511d49c0453f3c Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Sun, 27 Sep 2026 16:09:02 +0000 Subject: [PATCH] docs: run the pdf_image_extract() example only when png is installed The example extracts the fixture's image, which takes the non-JPEG path and so needs png, a suggested package. It did not check for png, so R CMD check with only strong dependencies available (_R_CHECK_DEPENDS_ONLY_=true, CRAN's noSuggests flavour) failed in the examples. R-hub's nosuggests container showed the failure. ?pdf_render_to_png's example already guards with requireNamespace("png"), and png is the only suggested package the package uses at run time. With the guard, nosuggests passes the examples and tests. Co-Authored-By: Claude Opus 5.5 --- R/images.R | 2 +- man/pdf_image_extract.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/images.R b/R/images.R index 1c2cc52..d6bbd2b 100644 --- a/R/images.R +++ b/R/images.R @@ -255,7 +255,7 @@ pdf_image_icc_profile <- function(obj) { #' fixture <- system.file("extdata", "fixtures", "image.pdf", #' package = "pdfium" #' ) -#' if (nzchar(fixture)) { +#' if (nzchar(fixture) && requireNamespace("png", quietly = TRUE)) { #' doc <- pdf_doc_open(fixture) #' page <- pdf_page_load(doc, 1L) #' imgs <- Filter(function(o) o$type == "image", pdf_page_objects(page)) diff --git a/man/pdf_image_extract.Rd b/man/pdf_image_extract.Rd index f8a6a04..d6afe3e 100644 --- a/man/pdf_image_extract.Rd +++ b/man/pdf_image_extract.Rd @@ -41,7 +41,7 @@ Mirrors pypdfium2's \code{PdfImage.extract()} convenience. fixture <- system.file("extdata", "fixtures", "image.pdf", package = "pdfium" ) -if (nzchar(fixture)) { +if (nzchar(fixture) && requireNamespace("png", quietly = TRUE)) { doc <- pdf_doc_open(fixture) page <- pdf_page_load(doc, 1L) imgs <- Filter(function(o) o$type == "image", pdf_page_objects(page))