NativeElixirPdfUtilities.Info (native_elixir_pdf_utilities v0.14.0)
View SourceReads PDF document information and page geometry and updates common metadata.
Information updates append an incremental revision. The existing PDF bytes and unspecified information dictionary entries remain unchanged. XMP metadata is outside this API and is neither read nor updated.
Summary
Types
Common fields from the active PDF information dictionary.
One effective page size in PDF points.
Functions
Returns whether the active PDF trailer declares encryption.
Returns common fields from the active PDF information dictionary.
Returns the validated number of pages in a PDF.
Returns each page's effective MediaBox size and normalized rotation.
Applies a patch to common PDF information fields and returns an updated PDF.
Types
@type error_reason() :: NativeElixirPdfUtilities.Pdf.Reader.error_reason()
@type info() :: NativeElixirPdfUtilities.Validators.InfoValidator.info()
Common fields from the active PDF information dictionary.
@type page_size() :: NativeElixirPdfUtilities.Validators.InfoValidator.page_size()
One effective page size in PDF points.
Functions
@spec encrypted?(binary()) :: {:ok, boolean()} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Returns whether the active PDF trailer declares encryption.
This validates the header, cross-reference chain, and trailer without trying to decrypt or interpret encrypted document objects.
@spec get(binary()) :: {:ok, info()} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Returns common fields from the active PDF information dictionary.
Missing fields are returned as nil. PDF dates are validated and converted
to NaiveDateTime; timezone suffixes are validated while the written
wall-clock value is retained.
@spec page_count(binary()) :: {:ok, non_neg_integer()} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Returns the validated number of pages in a PDF.
@spec page_sizes(binary()) :: {:ok, [page_size()]} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Returns each page's effective MediaBox size and normalized rotation.
Width and height use PDF points and reflect page rotation. Page numbers begin at one.
@spec put(binary(), map() | keyword()) :: {:ok, binary()} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Applies a patch to common PDF information fields and returns an updated PDF.
Omitted fields remain unchanged and nil removes a field. Text values must
be valid UTF-8. Dates accept Date, NaiveDateTime, DateTime, ISO 8601
strings, and valid PDF date strings.