NativeElixirPdfUtilities.Validators.InfoValidator (native_elixir_pdf_utilities v0.13.0)
View SourceValidation and normalization for PDF information inspection and updates.
The validator consumes the shared reader context, resolves the active information dictionary, validates supported field values, prepares effective page geometry, and produces metadata patches that writers can serialize without reinterpreting caller input.
Summary
Types
Normalized common PDF information fields.
One effective page size in PDF points.
Validated caller patch keyed by PDF information dictionary names.
Functions
Reads and validates the common fields in a shared PDF context.
Resolves and validates effective page sizes from a shared PDF context.
Validates and normalizes a caller-provided information patch.
Applies a prepared patch to a validated existing information dictionary.
Types
@type info() :: %{ title: String.t() | nil, author: String.t() | nil, subject: String.t() | nil, keywords: String.t() | nil, producer: String.t() | nil, creation_date: NaiveDateTime.t() | nil, modification_date: NaiveDateTime.t() | nil }
Normalized common PDF information fields.
@type page_size() :: %{ page_number: pos_integer(), width: float(), height: float(), unit: :point, rotation: 0 | 90 | 180 | 270, media_box: %{left: float(), bottom: float(), right: float(), top: float()} }
One effective page size in PDF points.
@type patch() :: %{ optional(binary()) => NativeElixirPdfUtilities.Validators.PdfValidator.value() | :remove }
Validated caller patch keyed by PDF information dictionary names.
Functions
@spec prepare_info(NativeElixirPdfUtilities.Validators.PdfValidator.context()) :: {:ok, info()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Reads and validates the common fields in a shared PDF context.
@spec prepare_page_sizes(NativeElixirPdfUtilities.Validators.PdfValidator.context()) :: {:ok, [page_size()]} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Resolves and validates effective page sizes from a shared PDF context.
@spec prepare_patch(term()) :: {:ok, patch()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Validates and normalizes a caller-provided information patch.
@spec prepare_write( NativeElixirPdfUtilities.Validators.PdfValidator.context(), patch() ) :: {:ok, map()} | {:error, {atom(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Applies a prepared patch to a validated existing information dictionary.