Elixir bindings for pdf_oxide, a high-performance PDF library written in Rust.
The public API lives under the submodules:
PdfElixide.Document— read-only inspection (open, page count, version, text extraction).PdfElixide.Editor— mutable, in-memory editor (open, mutate, save).PdfElixide.Form— AcroForm field access for both documents and editors.
Reading a document is open, extract, close:
doc = PdfElixide.Document.open!("report.pdf")
text = PdfElixide.Document.text!(doc, 0)
markdown = PdfElixide.Document.to_markdown!(doc)
:ok = PdfElixide.Document.close(doc)Concurrency
Every handle this library returns may be passed to other processes. A document, image, font or table reads through a shared lock, so one handle serves concurrent reads; an editor mutates, so its calls take the handle exclusively and serialize. The full account is the Concurrency guide.
File paths
A path is whatever the operating system calls one, handed to it unchanged. On
Unix that means an opaque byte string, so a filename with no UTF-8 spelling
works here just as it does with File.read/1, and a path that cannot be
opened or written is an :io error like any other.
On Windows a path must be valid UTF-8, and one that is not raises
ArgumentError before the filesystem is touched — see the "Errors versus
exceptions" section of PdfElixide.Error. Every well-formed Windows path has
a UTF-8 spelling, so this costs nothing in practice — but it does make this
library stricter than File there, which will translate a stray byte into
some legal filename and write it rather than refuse.
Only the binary form of Path.t() is accepted; a charlist raises
FunctionClauseError. A path is therefore shaped like a password — opaque
bytes rather than text, see PdfElixide.Document.open_opts/0 — and not like
:image_output_dir, which is a string because it is also pasted into the
generated markup; see PdfElixide.Document.markdown_opts/0.