Skip to contents

PDF attachments carry a /Params dictionary with metadata about the embedded file (size, modification date, checksums, MIME type, custom keys). pdf_attachments() surfaces the common entries; this function reads an arbitrary key. Wraps FPDFAttachment_HasKey + FPDFAttachment_GetValueType + FPDFAttachment_GetStringValue.

Usage

pdf_attachment_dict_value(doc, attachment_index, key, password = NULL)

Arguments

doc

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

attachment_index

One-based index into the attachment list.

key

The attachment-dict key as a single non-empty character string (e.g. "Subtype", "AFRelationship").

password

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

Value

A list:

  • has_key (logical) — TRUE when the attachment dict contains the key.

  • value_type (integer) — PDFium's FPDF_OBJECT_* enum value (0=unknown, 1=boolean, 2=number, 3=string, 4=name, ...). NA when the key is absent.

  • value (character) — the string / name value; NA_character_ when the value is not string-typed.

Details

Only string- and name-typed values are returned as character scalars. For numeric / boolean / dict values the function reports has_key = TRUE and value_type accordingly but value = NA_character_ (use pdf_attachments() for the structured size/date/checksum readouts).

See also