浏览代码

修复导出PDF的BUG

Minho 7 年之前
父节点
当前提交
0820397f10
共有 3 个文件被更改,包括 10 次插入7 次删除
  1. 5 2
      converter/converter.go
  2. 3 3
      models/book_result.go
  3. 2 2
      views/document/markdown_edit_template.tpl

+ 5 - 2
converter/converter.go

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

+ 3 - 3
models/book_result.go

@@ -199,7 +199,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
 	defer func(p string) {
 		os.RemoveAll(p)
 	}(tempOutputPath)
-	
+
 	if utils.FileExists(pdfpath) && utils.FileExists(epubpath) && utils.FileExists(mobipath) && utils.FileExists(docxpath) {
 		convertBookResult.EpubPath = epubpath
 		convertBookResult.MobiPath = mobipath
@@ -245,8 +245,8 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
 		Cover:        m.Cover,
 		Timestamp:    time.Now().Format("2006-01-02 15:04:05"),
 		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>",
-		Header:       "<p style='color:#8E8E8E;font-size:12px;'>_SECTION_</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>\"",
 		Identifier:   "",
 		Language:     "zh-CN",
 		Creator:      m.CreateName,

+ 2 - 2
views/document/markdown_edit_template.tpl

@@ -41,7 +41,7 @@
 <body>
 
 <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">
             <a href="{{urlfor "BookController.Index"}}" data-toggle="tooltip" data-title="返回"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
         </div>
@@ -103,7 +103,7 @@
         <div class="clearfix"></div>
     </div>
     <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="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>