df424f2de0
Añade 3 tipos Python (PDFDoc, PDFPage, PDFStyle) y 10 funciones Python para construir PDFs con fpdf2 (builder fluent), fusionar PDFs con pypdf y convertir HTML/Markdown a PDF via weasyprint (stub si no disponible). Añade pdf_simple_report en Go como stub hasta que go-pdf/fpdf se integre. - python/types/infra/: pdf_doc, pdf_page, pdf_style - python/functions/infra/: pdf_create, pdf_add_page, pdf_add_text, pdf_add_table, pdf_add_image, pdf_add_header_footer, pdf_from_html, pdf_from_markdown, pdf_merge, pdf_save - functions/infra/pdf_simple_report.go: stub Go con ReportSection/ReportTable - 17 tests Python pasando (pytest) - fpdf2 y pypdf añadidos via uv al venv Python Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.7 KiB
1.7 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| pdf_add_page | function | py | infra | 1.0.0 | impure | def pdf_add_page(doc, orientation, width, height) -> PDFDoc | Añade una pagina nueva al documento PDF con orientacion y tamaño configurables. Sin dimensiones personalizadas usa A4 con la orientacion indicada. |
|
|
|
false | error_go_core |
|
PDFDoc con la nueva pagina añadida; metadata de la pagina en doc.pages | true |
|
python/functions/infra/pdf_add_page_test.py | python/functions/infra/pdf_add_page.py |
Ejemplo
doc = pdf_create(title="Demo")
doc = pdf_add_page(doc) # A4 portrait
doc = pdf_add_page(doc, orientation="landscape") # A4 landscape
doc = pdf_add_page(doc, width=148, height=210) # A5 portrait
Notas
Llama a fpdf.add_page() con el formato adecuado. El header/footer configurado en pdf_add_header_footer se aplica automaticamente en cada pagina nueva (via subclase FPDF). Las dimensiones reales post-add se registran en doc.pages con las medidas internas de fpdf2 (que incluye los margenes).