package main import ( "fmt" "u-desk/internal/api" ) // ExportPDF 导出PDF文件 func (a *App) ExportPDF(content string, title string, fileName string, fontSize int, pageWidth int, pageHeight int) (map[string]interface{}, error) { if a.pdfAPI == nil { return map[string]interface{}{ "success": false, "message": "PDF导出功能未初始化", }, fmt.Errorf("PDF导出功能未初始化") } req := api.PdfExportRequest{ Content: content, Title: title, FileName: fileName, FontSize: fontSize, PageWidth: pageWidth, PageHeight: pageHeight, } result, err := a.pdfAPI.ExportMarkdownToPDF(req) if err != nil { return map[string]interface{}{ "success": false, "message": err.Error(), }, err } return map[string]interface{}{ "success": result.Success, "message": result.Message, "path": result.Path, "size": result.Size, }, nil } // SelectPDFSaveDirectory 选择PDF保存目录 func (a *App) SelectPDFSaveDirectory() (string, error) { if a.pdfAPI == nil { return "", fmt.Errorf("PDF导出功能未初始化") } return a.pdfAPI.SelectDirectory() }