A complete document with content, styles, and file attachments.
Summary
Functions
Add content to the document.
Add one or more style rules to the document.
Attach a file to the document (images, bibliography, etc).
Create an empty document.
Types
@type t() :: %Folio.Document{ content: [Folio.Content.t()], files: %{required(String.t()) => binary()}, styles: [Folio.Styles.rule()] }
Functions
@spec add_content(t(), Folio.Content.t() | [Folio.Content.t()] | String.t()) :: t()
Add content to the document.
@spec add_style(t(), Folio.Styles.rule() | [Folio.Styles.rule()]) :: t()
Add one or more style rules to the document.
Attach a file to the document (images, bibliography, etc).
Files are scoped to this document only — they don't leak across
independent compile calls. Prefer this over Folio.register_file/2
for session isolation.
doc =
Folio.Document.new()
|> Folio.Document.attach_file("logo.png", File.read!("logo.png"))
|> Folio.Document.add_content("")
@spec new() :: t()
Create an empty document.