feat: add report export capabilities with Pandoc and WeasyPrint support

- Updated Dockerfiles to include Pandoc and WeasyPrint runtime libraries for report generation.
- Enhanced report retrieval functionality to include version siblings in the response.
- Modified report export process to utilize WeasyPrint for PDF generation, improving output quality.
This commit is contained in:
Anish Sarkar 2026-02-11 23:24:51 +05:30
parent 5c9dd0b787
commit e7a73d0570
4 changed files with 13 additions and 1 deletions

View file

@ -121,6 +121,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libgbm1 \
libcairo2 \
libpango-1.0-0 \
# ============================
# Report export (Pandoc + WeasyPrint runtime libs)
# ============================
pandoc \
libpangoft2-1.0-0 \
libharfbuzz0b \
libharfbuzz-subset0 \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js 20.x (for running frontend)

View file

@ -20,6 +20,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxrender1 \
dos2unix \
git \
pandoc \
libpango-1.0-0 \
libpangoft2-1.0-0 \
libharfbuzz-subset0 \
&& rm -rf /var/lib/apt/lists/*
# Update certificates and install SSL tools

View file

@ -180,7 +180,7 @@ async def export_report(
# thread executor to avoid blocking the async event loop.
extra_args = ["--standalone"]
if format == ExportFormat.PDF:
extra_args.append("--pdf-engine=wkhtmltopdf")
extra_args.append("--pdf-engine=weasyprint")
loop = asyncio.get_running_loop()
output = await loop.run_in_executor(

View file

@ -64,6 +64,7 @@ dependencies = [
"langchain-unstructured>=1.0.1",
"slowapi>=0.1.9",
"pypandoc>=1.16.2",
"weasyprint>=68.1",
]
[dependency-groups]