DOCX and PDF export for Docmost, as a small service that runs beside Docmost rather than inside it.
Docmost's own DOCX and PDF export are commercial features. This is an independent implementation built on the public API of the community edition: it asks Docmost for the HTML export it already produces, then converts that locally with pandoc (DOCX) and WeasyPrint (PDF).
No Docmost code is copied, no license check is bypassed, and Docmost itself is never
modified — so docker compose pull keeps working and there is no fork to maintain.
If the paid features fit your situation, buying a license is the simpler answer and supports the people who build Docmost. This exists for those who need two formats and not a subscription.
- Single page, optionally with its subpages (returned as a ZIP)
- A whole space, one file per page in a ZIP
- Attachments included — images are fetched with the page and embedded
- Buttons inside Docmost's UI, added by one
<script>tag your reverse proxy injects; no browser extension, nothing installed per user - A bookmarklet, if you would rather not touch your proxy at all
- Diagnostics for when an export misbehaves, so a bug report can be specific
- English and Polish UI,
LANG_UI=en|pl
- Docmost you can reach over HTTP(S)
- An API key from Docmost (Settings → API keys), or an account without MFA
- Docker with Compose v2
git clone https://github.com/mrtipeq/docmost-export.git
cd docmost-export
sudo bash scripts/install.sh # creates .env, then stops
$EDITOR .env # DOCMOST_URL + DOCMOST_API_KEY
sudo bash scripts/install.sh # builds and startsOpen http://127.0.0.1:8091, paste a page URL, pick a format.
Optional, so it returns after a reboot:
sudo bash scripts/install-boot.shThe service authenticates to Docmost with a key that can read every page that account can see. Treat it as a credential store:
- it binds to
127.0.0.1by default — do not change that to0.0.0.0 - publish it, if at all, through your reverse proxy with authentication
.envis created0640, owned by root
Your reverse proxy serves the converter on the same origin as Docmost and adds one script tag to the HTML it already proxies. Snippets for Apache, nginx and Caddy.
Same origin matters: an HTTPS page cannot load an HTTP script, and a separate host
would need CORS. Serving the converter under a path such as /_export/ avoids both.
inject.js is deliberately served without authentication — it contains no secrets,
and a password prompt on a <script> load would only stop the buttons appearing.
Prefer not to touch your proxy? The converter page offers bookmarklets: drag one to your bookmarks bar and it opens the converter prefilled from whatever Docmost page you are on.
| Variable | Default | Meaning |
|---|---|---|
DOCMOST_URL |
— | Where Docmost's API lives |
DOCMOST_API_KEY |
— | Preferred credential; revocable from the Docmost UI |
DOCMOST_EMAIL / DOCMOST_PASSWORD |
— | Fallback; the account must not have MFA |
BIND_ADDR / BIND_PORT |
127.0.0.1 / 8091 |
Where the container publishes |
ROOT_PATH / PUBLIC_BASE |
empty | Set both (e.g. /_export) when proxied under a path |
LANG_UI |
en |
en or pl; add a file in app/locales/ for more |
PAGE_SIZE / PAGE_MARGIN |
A4 / 18mm 16mm |
PDF page setup |
REQUEST_TIMEOUT |
120 |
Seconds allowed for a Docmost call |
- Draw.io and Excalidraw diagrams export as whatever image Docmost puts in the HTML
- Mermaid blocks may come through as code rather than a rendered diagram
- Video is replaced with a labelled placeholder — paper cannot play it
- DOCX layout is pandoc's default; a house style needs a
--reference-doc
See docs/TROUBLESHOOTING.md. The short version: /diag?page=<url>
reports what Docmost answers for every combination of export options, and the
"do not convert" checkbox shows exactly which images arrived and whether they resolve.
The repository pins LF line endings via .gitattributes, because the shell scripts run
on a Linux host and a CRLF shebang fails there with bad interpreter: /bin/bash^M.
Nothing to configure; just do not "fix" the endings in an editor.
Translations are the easiest way in: copy app/locales/en.json, translate the values,
and CI will tell you if a key is missing. Bug reports are far more useful with the
output of /diag?page=<url> or the image diagnostics attached.
MIT — see LICENSE. Docmost itself is a separate project under its own licenses; this repository contains none of its code.

