NativeElixirPdfUtilities.Attachments (native_elixir_pdf_utilities v0.18.0)

View Source

Embeds caller-approved files and lists existing PDF attachments.

Files are stored as supplied. MIME detection is descriptive, not malware scanning or content sanitization. Callers must approve attachment content. No files are fetched, executed, extracted to disk, or automatically launched.

Summary

Functions

Embeds a list of maps containing :filename and binary :bytes.

Lists embedded filenames, descriptions, MIME types and declared byte sizes without extracting files.

Functions

embed(pdf, attachments, opts \\ [])

@spec embed(binary(), [map()], keyword()) ::
  {:ok, binary()}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Embeds a list of maps containing :filename and binary :bytes.

Optional :description and :mime_type describe the file. Recognized magic bytes take precedence over extension inference; clear conflicts return a diagnostic. Unknown types use application/octet-stream. Duplicate filenames are rejected. Options currently must be empty.

list(pdf)

@spec list(binary()) ::
  {:ok, [map()]}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Lists embedded filenames, descriptions, MIME types and declared byte sizes without extracting files.