Like pdf_save() but returns the saved PDF's bytes as a raw
vector instead of writing to disk. Useful for piping the
serialised PDF directly into another consumer
(httr2::req_body_raw(), aws.s3::put_object(), etc.).
Usage
pdf_save_to_raw(
doc,
incremental = FALSE,
remove_security = FALSE,
subset_new_fonts = TRUE,
version = NULL
)Arguments
- doc
A
pdfium_docfrompdf_doc_open()orpdf_doc_new().- incremental
Logical. If
TRUE, append an incremental update preserving the original byte layout (required for signed-PDF workflows). IfFALSE(default), rewrite the whole file.- remove_security
Logical. If
TRUE, strip the encryption dictionary from the saved copy. DefaultsFALSE. Use with caution.- subset_new_fonts
Logical. If
TRUE(default), subset newly-embedded fonts the same way Acrobat does. SetFALSEto embed full font tables.- version
Integer or
NULL. The PDF version in PDFium's "10 * major + minor" form (e.g.17for PDF 1.7).NULL(default) preserves the input file's declared version.
See also
pdf_save() for disk output.