URP
Copy MarkdownPure Elixir client for the UNO Remote Protocol.
Talks directly to a soffice process over a TCP socket —
no Python, no wrappers, no sidecars.
Installation
{:urp, "~> 0.8"}Prerequisites
A running soffice with a URP socket listener:
docker build --tag soffice --file benchmarks/Dockerfile.soffice-debian benchmarks/
docker run --detach --name soffice --publish 2002:2002 soffice
Usage
A default pool connects to localhost:2002 automatically.
# file path, {:binary, bytes}, or any Enumerable as input
{:ok, pdf_path} =
URP.convert("/path/to/input.docx",
filter: "writer_pdf_Export",
filter_data: [Quality: 90, ReduceImageResolution: true, MaxImageResolution: 150]
)
# docx to Markdown, output as binary
{:ok, md} = URP.convert({:binary, docx_bytes}, filter: "Markdown", output: :binary)
{:ok, "26.2.0.3"} = URP.version()
{:ok, filters} = URP.filters()See URP.convert/2 for all options (filter names,
FilterData properties).
Configuration
# config/runtime.exs
config :urp, :default,
host: "soffice",
port: 2002,
pool_size: 1pool_size
Each connection needs its own soffice instance. With pool_size: 3,
run 3 soffice containers — one per connection. Concurrent operations
on a single soffice process are not safe.
Testing
Stub conversions in tests — no running soffice needed. See URP.Test.
URP.Test.stub(fn _input, _opts -> {:ok, "/tmp/fake.pdf"} end)
assert {:ok, _} = MyApp.generate_invoice(order)Telemetry
Every operation emits [:urp, :call, :stop] with queue, service, and
total time measurements. See URP.Telemetry.
Performance
See PERFORMANCE.md for benchmarks and container image recommendations.
References
- UNO Binary Protocol Spec
- binaryurp source — reader.cxx, writer.cxx, marshal.cxx
- Export filter names
Releasing
./release.sh patch # or minor, major
git push origin main --tags
License
MIT — see LICENSE.