NativeElixirPdfUtilities.HtmlToPdf.ResourceContext (native_elixir_pdf_utilities v1.1.0)

View Source

Internal resource scope for local embedded documents.

The authorization root is fixed for the scope. Resolution bases and document identities belong to individual documents. Children share the outer render, font and image budgets and never acquire a resolver. These contexts must be used inside run/3; they are not persistent permissions.

Summary

Functions

Changes resolution without changing permission roots, issued identities or budgets.

Runs local child work in the existing render scopes, sharing the supplied image budget.

Runs an issued document in its own resource scope while preserving cumulative caches.

Types

t()

@type t() :: %NativeElixirPdfUtilities.HtmlToPdf.ResourceContext{
  ancestors: [term()],
  authorization_root: String.t() | nil,
  depth: non_neg_integer(),
  document_id: reference(),
  image_budget:
    NativeElixirPdfUtilities.Validators.HtmlValidator.image_budget(),
  resolution_base: String.t() | nil,
  scope: reference(),
  tree_scope_id: reference()
}

Functions

rebase(context, base)

@spec rebase(t(), term()) ::
  {:ok, t()}
  | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}

Changes resolution without changing permission roots, issued identities or budgets.

Local strings and file URIs retain the directory API. Use {:document_url, absolute_url} for a validated document URL, whose final path segment remains a document name rather than becoming a resolution directory.

run(opts, image_budget, fun)

@spec run(
  keyword(),
  NativeElixirPdfUtilities.Validators.HtmlValidator.image_budget(),
  (t() -> result)
) ::
  result | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
when result: term()

Runs local child work in the existing render scopes, sharing the supplied image budget.

with_document(context, fun)

@spec with_document(t(), (-> result)) ::
  result | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
when result: term()

Runs an issued document in its own resource scope while preserving cumulative caches.