Export the NMS Prime Confluence contract tree to one merged PDF. German is the default; English uses the same options on a parallel page tree.
The script walks the root page and all descendants in sidebar order. For each page it either:
- exports a linked public Google Doc,
- converts a Word/PDF attachment, or
- prints the Confluence HTML with headless Chrome
and then merges the parts with pdfunite.
Default root: German (8533089).
English root: English (8533093), via --lang en.
curl, python3, pdfunite (poppler-utils), and Chrome/Chromium. LibreOffice is only needed to convert Word/ODT attachments.
./export-confluence-pdf.sh
./export-confluence-pdf.sh --out ./contracts.pdfSame options, different root: English (8533093).
./export-confluence-pdf.sh --lang en --out ./contracts-en.pdf
./export-confluence-pdf.sh --lang en --type cloud --no-hw-support
./export-confluence-pdf.sh --lang en --leistungsschein 1192067073 --out ./customer-en.pdf| German page | English page | --replace alias |
|---|---|---|
| Leistungsschein | Service Agreement | leistungsschein / service-agreement |
| AGB | GTC | agb / gtc |
| EULA german | EULA | eula |
| HBV | ALL | hbv / all |
| AVV | DPA | avv / dpa |
| PT | PT – Payment Terms | pt |
Cancelled heading stubs are English too (2.3. omitted for Cloud, 3.1. omitted). --page-id / --url override this root if you need a subtree.
Swap one page’s content (for example Leistungsschein) but keep the original child pages:
./export-confluence-pdf.sh --leistungsschein 1192067073 --out ./stadtwerker.pdf
./export-confluence-pdf.sh --replace avv=111 --replace hbv=222--leistungsschein is a shortcut for --replace leistungsschein=… (English title: Service Agreement).
--replace SLOT=PAGE can be repeated. SLOT is a page id, title, or alias (leistungsschein / service-agreement, agb / gtc, eula, hbv / all, pt, abnahme, avv / dpa, tom). PAGE is a page id or Confluence URL.
In Confluence, tag headings or single lines with [Cloud], [On-Prem], or [Hardware-Support] (any capitalization).
./export-confluence-pdf.sh --type cloud
./export-confluence-pdf.sh --type on-prem --no-hw-support
./export-confluence-pdf.sh --leistungsschein 1192067073 --type cloud --out ./stadtwerker.pdf--type cloudor--type on-prem— drop the other variant’s plain lines. Cancelled headings stay as a light-gray stub so numbering remains (2.3. entfällt bei Cloud, or2.3. omitted for Cloudwith--lang en).--no-hw-support— same for[Hardware-Support]; cancelled headings become3.1. entfällt/3.1. omitted.- Kept tags are unwrapped:
[Cloud]-Usage→Cloud-Usage.
HTML pages only (Leistungsschein, etc.). Google-Doc pages (AGB, AVV) are not filtered.
Without --type / --no-hw-support, all sections stay and tags stay visible.
| Option | Meaning |
|---|---|
--lang de|en |
German (default) or English contract tree |
--page-id ID |
Start at this page (overrides --lang root) |
--url URL |
Same, parsed from a Confluence URL |
--base-url URL |
Wiki base (default https://nmsprime.atlassian.net/wiki) |
--out FILE |
Output PDF (default: ./<root-title>_merged.pdf) |
--keep-parts |
Also keep the individual page PDFs |
-h / --help |
Show usage |
export CONFLUENCE_EMAIL=you@example.com
export CONFLUENCE_API_TOKEN=...