Skip to contents

Returns the number of pages in doc. Accepts either an open pdfium_doc or a character path (in which case it opens and closes the document internally — convenient for one-shot inspection).

Usage

pdf_page_count(doc, password = NULL)

Arguments

doc

A pdfium_doc from pdf_doc_open(), or a character scalar path.

password

Optional password for encrypted PDFs when doc is a path. Ignored when doc is already an open pdfium_doc.

Value

An integer scalar — the page count.

Examples

fixture <- system.file("extdata", "fixtures", "minimal.pdf",
  package = "pdfium"
)
if (nzchar(fixture)) {
  pdf_page_count(fixture)
}
#> [1] 1