docinfo() creates a PDF documentation info dictionary object.
Such objects can be used with set_docinfo() to edit PDF documentation info dictionary entries
and such objects are returned by get_docinfo().
Usage
docinfo(
author = NULL,
creation_date = NULL,
creator = NULL,
producer = NULL,
title = NULL,
subject = NULL,
keywords = NULL,
mod_date = NULL,
...
)Arguments
The document's author. Matching xmp metadata tag is
dc:creator.- creation_date
The date the document was created. Will be coerced by
datetimeoffset::as_datetimeoffset(). Matching xmp metadata tag isxmp:CreateDate.- creator
The name of the application that originally created the document (if converted to pdf). Matching xmp metadata tag is
xmp:CreatorTool.- producer
The name of the application that converted the document to pdf. Matching xmp metadata tag is
pdf:Producer.- title
The document's title. Matching xmp metadata tag is
dc:title.- subject
The document's subject. Matching xmp metadata tag is
dc:description.- keywords
Keywords for this document (for cross-document searching). Matching xmp metadata tag is
pdf:Keywords. Will be coerced into a string bystringi::stri_join(keywords, collapse = ", ").- mod_date
The date the document was last modified. Will be coerced by
datetimeoffset::as_datetimeoffset(). Matching xmp metadata tag isxmp:ModifyDate.- ...
Arbitrary (non-standard) info dictionary entries. The names are the info dictionary key names and the values (which should be strings) are the info dictionary values.
docinfo R6 Class Methods
get_item(key)Get documentation info value for key
key. Can also use the relevant active bindings to get documentation info values.set_item(key, value)Set documentation info key
keywith valuevalue. Can also use the relevant active bindings to set documentation info values.update(x)Update documentation info key entries using non-
NULLentries in objectxcoerced byas_docinfo().
docinfo R6 Active Bindings
authorThe document's author.
creation_dateThe date the document was created.
creatorThe name of the application that originally created the document (if converted to pdf).
producerThe name of the application that converted the document to pdf.
titleThe document's title.
subjectThe document's subject.
keywordsKeywords for this document (for cross-document searching).
mod_dateThe date the document was last modified.
See also
get_docinfo() and set_docinfo() for getting/setting such information from/to PDF files.
as_docinfo() for coercing to this object.
as_xmp() can be used to coerce docinfo() objects into xmp() objects.
See edit_docinfo() for known limitations regarding arbitrary (non-standard)
info dictionary entry support across the different get/set backends.
Examples
if (supports_set_docinfo() && supports_get_docinfo() && 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())
cat("\nInitial documentation info\n")
d <- get_docinfo(f)[[1]]
print(d)
d <- update(d,
author = "John Doe",
title = "Two Boring Pages",
keywords = "R, xmpdf")
set_docinfo(d, f)
cat("\nDocumentation info after setting it\n")
print(get_docinfo(f)[[1]])
unlink(f)
}
#>
#> Initial documentation info
#> Author: NULL
#> CreationDate: 2026-08-25T13:12:17
#> Creator: R
#> Producer: R 4.6.1
#> Title: R Graphics Output
#> Subject: NULL
#> Keywords: NULL
#> ModDate: 2026-08-25T13:12:17
#>
#> Documentation info after setting it
#> Author: John Doe
#> CreationDate: 2026-08-25T13:12:17
#> Creator: R
#> Producer: R 4.6.1
#> Title: Two Boring Pages
#> Subject: NULL
#> Keywords: R, xmpdf
#> ModDate: 2026-08-25T13:12:17