n_pages() returns the number of pages in the (pdf) file(s).
Usage
n_pages(filename, use_names = TRUE)
n_pages_exiftool(filename, use_names = TRUE)
n_pages_qpdf(filename, use_names = TRUE)
n_pages_pdftk(filename, use_names = TRUE)
n_pages_gs(filename, use_names = TRUE)Details
n_pages() will try to use the following helper functions in the following order:
n_pages_qpdf()which wrapsqpdf::pdf_length()n_pages_exiftool()which wrapsexiftoolcommand-line tooln_pages_pdftk()which wrapspdftkcommand-line tooln_pages_gs()which wrapsghostscriptcommand-line tool
See also
supports_n_pages() detects support for this feature.