NativeElixirPdfUtilities.Split (native_elixir_pdf_utilities v0.18.0)
View SourceRebuilds one PDF as multiple valid PDF documents.
Page numbers are one-based and follow the source document's page-tree order. Ranges are inclusive, ascending, and must use a step of one. Every output receives a new catalog, page tree, cross-reference table, and trailer.
Summary
Functions
Rebuilds a PDF as two non-empty PDFs split after page_number.
Rebuilds every source page as an individual PDF.
Rebuilds each inclusive source-page range as a separate PDF.
Types
Functions
@spec after_page(binary(), pos_integer()) :: {:ok, {binary(), binary()}} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Rebuilds a PDF as two non-empty PDFs split after page_number.
The selected page is the final page in the first output. The split point must be between page one and the penultimate page. The configured split output limit must allow two outputs.
@spec by_page(binary()) :: {:ok, [binary()]} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Rebuilds every source page as an individual PDF.
A document with no pages returns an empty output list. The configured split output limit must allow one output per source page.
@spec by_ranges(binary(), [Range.t()]) :: {:ok, [binary()]} | {:error, {error_reason(), NativeElixirPdfUtilities.Diagnostics.diagnostic()}}
Rebuilds each inclusive source-page range as a separate PDF.
The range list must be non-empty. Every range must be ascending and use a step of one. Ranges may overlap because each range describes an independent output. The configured split output limit must allow one output per range.