diff --git a/utils/pdf/html_to_pdf.go b/utils/pdf/html_to_pdf.go
index 0469f936..1c89fed7 100644
--- a/utils/pdf/html_to_pdf.go
+++ b/utils/pdf/html_to_pdf.go
@@ -6,7 +6,7 @@ import (
)
// html转 Pdf dataType = 1 为网页url dataType = 2为网页内容 outFile为空则不保存
-func HtmlToPdf(content string, dataType int, outFile string) ([]byte, error) {
+func HtmlToPdf(content string, dataType int, outFile ...string) ([]byte, error) {
pdfg, err := wkhtmltopdf.NewPDFGenerator()
if err != nil {
return nil, err
@@ -26,8 +26,8 @@ func HtmlToPdf(content string, dataType int, outFile string) ([]byte, error) {
return nil, err
}
// Write PDF to file
- if outFile != "" {
- if err = pdfg.WriteFile(outFile); err != nil {
+ if len(outFile) != 0 {
+ if err = pdfg.WriteFile(outFile[0]); err != nil {
return nil, err
}
}