NetBox Customer Export plugin with configurable branding

Plugin for NetBox 4.6.8–4.6.99 that exports customer documentation
(PDF, Word, HTML preview) for a site, location, tenant or tenant group.
Technicians pick sections, device roles and columns before exporting.

Branding profiles (colors, font, logo, footer, Word template incl. .dotx,
table style, extra CSS) are configurable via PLUGINS_CONFIG and selectable
per export.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-09-23 12:43:19 +02:00
commit 8f45bffa99
21 files changed
+1444

No files matched your search

@@ -0,0 +1,23 @@
class MissingDependency(Exception):
pass
def render(doc, fmt, request=None):
"""Gibt (bytes, content_type, dateiendung) zurück."""
if fmt == "docx":
from .docx import render_docx
return render_docx(doc), "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx"
from .html import render_html
html = render_html(doc)
if fmt == "html":
return html, "text/html; charset=utf-8", "html"
try:
from weasyprint import HTML
except (ImportError, OSError) as e:
raise MissingDependency(f"PDF-Export benötigt WeasyPrint (pip install weasyprint + Pango): {e}")
base_url = request.build_absolute_uri("/") if request else None
return HTML(string=html, base_url=base_url).write_pdf(), "application/pdf", "pdf"