n_pages | R Documentation |
n_pages()
returns the number of pages in the (pdf) file(s).
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)
filename |
Character vector of filenames. |
use_names |
If |
n_pages()
will try to use the following helper functions in the following order:
n_pages_qpdf()
which wraps qpdf::pdf_length()
n_pages_exiftool()
which wraps exiftool
command-line tool
n_pages_pdftk()
which wraps pdftk
command-line tool
n_pages_gs()
which wraps ghostscript
command-line tool
An integer vector of number of pages within each file.
supports_n_pages()
detects support for this feature.
if (supports_n_pages() && require("grid", quietly = TRUE)) {
f <- tempfile(fileext = ".pdf")
pdf(f, onefile = TRUE)
grid.text("Page 1")
grid.newpage()
grid.text("Page 2")
invisible(dev.off())
print(n_pages(f))
unlink(f)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.