Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 28s
CI / test-go-edu-search (push) Successful in 28s
CI / test-python-klausur (push) Failing after 2m22s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 23s
korrektur/ zeugnis/ admin/ compliance/ worksheet/ training/ metrics/ 52 shims, relative imports, RAG untouched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
948 B
Python
32 lines
948 B
Python
"""
|
|
NRU Worksheet PDF — PDF generation using weasyprint.
|
|
|
|
Extracted from nru_worksheet_generator.py for modularity.
|
|
"""
|
|
|
|
from typing import List, Dict, Tuple
|
|
|
|
from .nru_html import generate_nru_worksheet_html
|
|
|
|
|
|
async def generate_nru_pdf(entries: List[Dict], title: str = "Vokabeltest", include_solutions: bool = True) -> Tuple[bytes, bytes]:
|
|
"""
|
|
Generate NRU worksheet PDFs.
|
|
|
|
Returns:
|
|
Tuple of (worksheet_pdf_bytes, solution_pdf_bytes)
|
|
"""
|
|
from weasyprint import HTML
|
|
|
|
# Generate worksheet HTML
|
|
worksheet_html = generate_nru_worksheet_html(entries, title, show_solutions=False)
|
|
worksheet_pdf = HTML(string=worksheet_html).write_pdf()
|
|
|
|
# Generate solution HTML
|
|
solution_pdf = None
|
|
if include_solutions:
|
|
solution_html = generate_nru_worksheet_html(entries, title, show_solutions=True)
|
|
solution_pdf = HTML(string=solution_html).write_pdf()
|
|
|
|
return worksheet_pdf, solution_pdf
|