--- name: pdf_simple_report kind: function lang: go domain: infra version: "1.0.0" purity: impure signature: "func PdfSimpleReport(title string, sections []ReportSection, outputPath string) (string, error)" description: "Genera un PDF simple con titulo, secciones de texto y tablas opcionales. Stub activo: requiere go-pdf/fpdf que no esta en el modulo. Para PDFs desde Go añadir la dependencia; para casos complejos usar el builder Python." tags: [pdf, report, go, stub, infra] uses_functions: [] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: [fmt] params: - name: title desc: "titulo principal del reporte PDF, aparece en la cabecera del documento" - name: sections desc: "lista de ReportSection, cada una con Title (string), Text (string) y Table opcional (*ReportTable con Headers y Rows)" - name: outputPath desc: "ruta del archivo PDF a generar en disco" output: "outputPath con el PDF generado, o string vacio + error si la dependencia no esta disponible" tested: false tests: [] test_file_path: "" file_path: "functions/infra/pdf_simple_report.go" --- ## Tipos auxiliares ```go type ReportSection struct { Title string Text string Table *ReportTable // nil = sin tabla en esta seccion } type ReportTable struct { Headers []string Rows [][]string } ``` ## Ejemplo de uso ```go sections := []infra.ReportSection{ { Title: "Estado del Registry", Text: "El registry contiene 142 funciones, 38 tipos y 12 proposals pendientes.", }, { Title: "Funciones por Dominio", Table: &infra.ReportTable{ Headers: []string{"Dominio", "Funciones", "Tipos"}, Rows: [][]string{ {"core", "45", "12"}, {"infra", "38", "8"}, {"finance", "22", "6"}, }, }, }, } path, err := infra.PdfSimpleReport("Registry Status Report", sections, "registry_report.pdf") if err != nil { log.Fatal(err) } fmt.Println("PDF generado:", path) ``` ## Activar la implementacion real ```bash # Añadir dependencia al modulo Go go get github.com/go-pdf/fpdf # La funcion usa la API de go-pdf/fpdf: # pdf := fpdf.New("P", "mm", "A4", "") # pdf.AddPage() # pdf.SetFont("Arial", "B", 16) # pdf.Cell(0, 10, title) # ... para cada seccion y tabla # pdf.OutputFileAndClose(outputPath) ``` ## Notas Stub activo: retorna `fmt.Errorf("not implemented: ...")` hasta que `go-pdf/fpdf` se añada al modulo. No añadida como dependencia directa porque solo la usa esta funcion y añade peso al modulo. Para generacion de PDFs desde el registry, la solucion recomendada es el builder Python (`pdf_create_py_infra` + `pdf_add_text_py_infra` + `pdf_add_table_py_infra` + `pdf_save_py_infra`) que es mas completo y no requiere dependencias adicionales en Go.