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>
2.1 KiB
2.1 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_text | function | py | infra | 1.0.0 | impure | def pdf_add_text(doc, text, style, x, y, width) -> PDFDoc | Escribe un bloque de texto en el documento PDF con fuente, tamaño, color y alineacion del PDFStyle dado. Soporta saltos de linea y word wrap automatico. |
|
|
|
false | error_go_core |
|
PDFDoc con el texto añadido en la pagina activa | true |
|
python/functions/infra/pdf_add_text_test.py | python/functions/infra/pdf_add_text.py |
Ejemplo
from pdf_style import PDFStyle
titulo = PDFStyle(font_family="Helvetica-Bold", font_size=18.0, alignment="center")
cuerpo = PDFStyle(font_size=11.0, alignment="justify", margin_bottom=4.0)
doc = pdf_add_text(doc, "Informe Mensual", style=titulo)
doc = pdf_add_text(doc, "Este reporte resume las ejecuciones de Abril 2026.", style=cuerpo)
Notas
Usa multi_cell internamente para soportar word wrap automatico y saltos de linea \n. La altura de linea se calcula en mm a partir de font_size * line_height. Las fuentes built-in soportan variantes -Bold, -Oblique, -BoldOblique en el nombre de font_family (se separan internamente para fpdf2).