mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-12-20 04:00:05 +08:00
优化pdf生成
This commit is contained in:
@@ -760,9 +760,8 @@ func (c *DocumentController) Export() {
|
|||||||
pdfpath := "cache/" + identify + "_" + c.CruSession.SessionID() + ".pdf"
|
pdfpath := "cache/" + identify + "_" + c.CruSession.SessionID() + ".pdf"
|
||||||
|
|
||||||
if _,err := os.Stat(pdfpath); os.IsNotExist(err){
|
if _,err := os.Stat(pdfpath); os.IsNotExist(err){
|
||||||
paths := make([]string, len(docs))
|
|
||||||
index := 0
|
|
||||||
|
|
||||||
|
wkhtmltopdf.SetPath(beego.AppConfig.String("wkhtmltopdf"))
|
||||||
pdfg, err := wkhtmltopdf.NewPDFGenerator()
|
pdfg, err := wkhtmltopdf.NewPDFGenerator()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -771,7 +770,9 @@ func (c *DocumentController) Export() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for e := pathList.Front(); e != nil; e = e.Next() {
|
for e := pathList.Front(); e != nil; e = e.Next() {
|
||||||
pdfg.AddPage(wkhtmltopdf.NewPage(paths[index]))
|
if page,ok := e.Value.(string); ok {
|
||||||
|
pdfg.AddPage(wkhtmltopdf.NewPage(page))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
err = pdfg.Create()
|
err = pdfg.Create()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user