修复导出PDF的BUG

pull/219/head v0.7.2
Minho 2018-01-29 16:22:39 +08:00
parent 7a90148507
commit 0820397f10
3 changed files with 10 additions and 7 deletions

View File

@ -137,19 +137,22 @@ func (this *Converter) Convert() (err error) {
case "epub": case "epub":
if err = this.convertToEpub(); err != nil { if err = this.convertToEpub(); err != nil {
errs = append(errs, err.Error()) errs = append(errs, err.Error())
fmt.Println("转换EPUB文档失败" + err.Error())
} }
case "mobi": case "mobi":
if err = this.convertToMobi(); err != nil { if err = this.convertToMobi(); err != nil {
errs = append(errs, err.Error()) errs = append(errs, err.Error())
fmt.Println("转换MOBI文档失败" + err.Error())
} }
case "pdf": case "pdf":
if err = this.convertToPdf(); err != nil { if err = this.convertToPdf(); err != nil {
fmt.Println(err) fmt.Println("转换PDF文档失败" + err.Error())
errs = append(errs, err.Error()) errs = append(errs, err.Error())
} }
case "docx": case "docx":
if err = this.convertToDocx(); err != nil { if err = this.convertToDocx(); err != nil {
fmt.Println(err) fmt.Println("转换WORD文档失败" + err.Error())
errs = append(errs, err.Error()) errs = append(errs, err.Error())
} }
} }

View File

@ -199,7 +199,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
defer func(p string) { defer func(p string) {
os.RemoveAll(p) os.RemoveAll(p)
}(tempOutputPath) }(tempOutputPath)
if utils.FileExists(pdfpath) && utils.FileExists(epubpath) && utils.FileExists(mobipath) && utils.FileExists(docxpath) { if utils.FileExists(pdfpath) && utils.FileExists(epubpath) && utils.FileExists(mobipath) && utils.FileExists(docxpath) {
convertBookResult.EpubPath = epubpath convertBookResult.EpubPath = epubpath
convertBookResult.MobiPath = mobipath convertBookResult.MobiPath = mobipath
@ -245,8 +245,8 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
Cover: m.Cover, Cover: m.Cover,
Timestamp: time.Now().Format("2006-01-02 15:04:05"), Timestamp: time.Now().Format("2006-01-02 15:04:05"),
Description: string(blackfriday.MarkdownBasic([]byte(m.Description))), Description: string(blackfriday.MarkdownBasic([]byte(m.Description))),
Footer: "<p style='color:#8E8E8E;font-size:12px;'>本文档使用 <a href='https://www.iminho.me' style='text-decoration:none;color:#1abc9c;font-weight:bold;'>MinDoc</a> 构建 <span style='float:right'>- _PAGENUM_ -</span></p>", Footer: "\"<p style='color:#8E8E8E;font-size:12px;'>本文档使用 <a href='https://www.iminho.me' style='text-decoration:none;color:#1abc9c;font-weight:bold;'>MinDoc</a> 构建 <span style='float:right'>- _PAGENUM_ -</span></p>\"",
Header: "<p style='color:#8E8E8E;font-size:12px;'>_SECTION_</p>", Header: "\"<p style='color:#8E8E8E;font-size:12px;'>_SECTION_</p>\"",
Identifier: "", Identifier: "",
Language: "zh-CN", Language: "zh-CN",
Creator: m.CreateName, Creator: m.CreateName,

View File

@ -41,7 +41,7 @@
<body> <body>
<div class="m-manual manual-editor"> <div class="m-manual manual-editor">
<div class="manual-head" id="editormd-tools" style="min-width: 1200px;"> <div class="manual-head" id="editormd-tools" style="min-width: 1200px; position:absolute;">
<div class="editormd-group"> <div class="editormd-group">
<a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a> <a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
</div> </div>
@ -103,7 +103,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div class="manual-body"> <div class="manual-body">
<div class="manual-category" id="manualCategory"> <div class="manual-category" id="manualCategory" style="position:absolute;">
<div class="manual-nav"> <div class="manual-nav">
<div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> 文档</div> <div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> 文档</div>
<div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="创建文档" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div> <div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="创建文档" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>