mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
- Replace ReportLab PDF export with LibreOffice headless for proper DOCX formatting preservation - Add libreoffice-writer + fonts-liberation to backend Dockerfile - Proxy public CV PDFs through frontend (/cv/[slug]) instead of redirecting to MinIO storage directly - Fix docker-compose: route backend/worker to internal MinIO URL (http://cvfs-minio:9000), remove MinIO from public network, parameterize all domain/env vars - Add storage cleanup (MinIO artifact deletion) when a document is deleted - Add docker-compose.standalone.yml for self-deployment without Traefik/dokploy - Update .env.example with comprehensive self-deployment documentation https://claude.ai/code/session_017HGM9VPptZG52asT5pbL6Y
22 lines
638 B
Python
22 lines
638 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
import subprocess
|
|
import tempfile
|
|
|
|
|
|
def docx_bytes_to_pdf(docx_bytes: bytes) -> bytes:
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
docx_path = os.path.join(tmpdir, "cv.docx")
|
|
pdf_path = os.path.join(tmpdir, "cv.pdf")
|
|
with open(docx_path, "wb") as f:
|
|
f.write(docx_bytes)
|
|
subprocess.run(
|
|
["libreoffice", "--headless", "--convert-to", "pdf", "--outdir", tmpdir, docx_path],
|
|
check=True,
|
|
capture_output=True,
|
|
timeout=60,
|
|
)
|
|
with open(pdf_path, "rb") as f:
|
|
return f.read()
|