fix:订单发票调整
This commit is contained in:
@@ -3,15 +3,16 @@ package pdf
|
||||
import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"github.com/SebastiaanKlippert/go-wkhtmltopdf"
|
||||
"strings"
|
||||
|
||||
"github.com/SebastiaanKlippert/go-wkhtmltopdf"
|
||||
)
|
||||
|
||||
/*
|
||||
html转 Pdf
|
||||
outFile为空则不保存(使用该方法需要安装工具 sudo apt-get install wkhtmltopdf)
|
||||
*/
|
||||
func HtmlToPdfBase64(content string, dataType string, outFile ...string) (string, error) {
|
||||
func HtmlToPdfBase64(content string, dataType string, pageSize string, outFile ...string) (string, error) {
|
||||
pdfg, err := wkhtmltopdf.NewPDFGenerator()
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -27,7 +28,7 @@ func HtmlToPdfBase64(content string, dataType string, outFile ...string) (string
|
||||
//模式
|
||||
pdfg.Orientation.Set(wkhtmltopdf.OrientationPortrait)
|
||||
//pdf尺寸默认A4纸
|
||||
pdfg.PageSize.Set(wkhtmltopdf.PageSizeA4)
|
||||
pdfg.PageSize.Set(pageSize)
|
||||
// Create PDF document in memory
|
||||
if err = pdfg.Create(); err != nil {
|
||||
return "", err
|
||||
|
||||
Reference in New Issue
Block a user