Returns a tibble row per /EmbeddedFile object in the
document. Wraps FPDFDoc_GetAttachmentCount,
FPDFDoc_GetAttachment, FPDFAttachment_GetName,
FPDFAttachment_GetSubtype, and FPDFAttachment_GetFile's
size-query form.
Arguments
- doc
A
pdfium_docfrompdf_doc_open(), or a character path.
Value
A tibble with columns:
attachment_indexinteger - 1-based index into the document's attachment table; pass this topdf_attachment_data()to read the file's bytes.namecharacter - filename declared in the attachment's/F(preferred) or/UFentry.mime_typecharacter - the attachment's/Subtype(e.g."application/xml","image/png"). Empty string if none declared.size_bytesnumeric - the embedded file's decompressed byte size.NAwhen PDFium reports the contents are unreadable.
Returns a 0-row tibble of the same schema when the document has no attachments.
Examples
fixture <- system.file("extdata", "fixtures", "shapes.pdf",
package = "pdfium"
)
if (nzchar(fixture)) pdf_attachments(fixture)
#> # A tibble: 0 × 4
#> # ℹ 4 variables: attachment_index <int>, name <chr>, mime_type <chr>,
#> # size_bytes <dbl>