mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-10-22 03:47:26 +08:00
优化页眉的显示
This commit is contained in:
@@ -476,12 +476,12 @@ func (this *Converter) convertToPdf() (err error) {
|
|||||||
|
|
||||||
//header template
|
//header template
|
||||||
if len(this.Config.Header) > 0 {
|
if len(this.Config.Header) > 0 {
|
||||||
args = append(args, "--pdf-header-template", this.Config.Header)
|
args = append(args, "--pdf-header-template", GetFooterOrHeaderParams(this.Config.Header))
|
||||||
}
|
}
|
||||||
|
|
||||||
//footer template
|
//footer template
|
||||||
if len(this.Config.Footer) > 0 {
|
if len(this.Config.Footer) > 0 {
|
||||||
args = append(args, "--pdf-footer-template", this.Config.Footer)
|
args = append(args, "--pdf-footer-template",GetFooterOrHeaderParams(this.Config.Footer))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(this.Config.MarginLeft) > 0 {
|
if len(this.Config.MarginLeft) > 0 {
|
||||||
|
@@ -45,3 +45,7 @@ func parseConfig(configFile string) (cfg Config, err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetFooterOrHeaderParams(v string) string {
|
||||||
|
return v
|
||||||
|
}
|
5
converter/util_linux.go
Normal file
5
converter/util_linux.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package converter
|
||||||
|
|
||||||
|
func GetFooterOrHeaderParams(v string) string {
|
||||||
|
return "\"" + v +"\""
|
||||||
|
}
|
@@ -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,
|
||||||
@@ -264,7 +264,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
|
|||||||
More: []string{},
|
More: []string{},
|
||||||
}
|
}
|
||||||
if m.Publisher != "" {
|
if m.Publisher != "" {
|
||||||
ebookConfig.Footer = "\"<p style='color:#8E8E8E;font-size:12px;'>本文档由 <span style='text-decoration:none;color:#1abc9c;font-weight:bold;'>"+ m.Publisher +"</span> 生成<span style='float:right'>- _PAGENUM_ -</span></p>\""
|
ebookConfig.Footer = "<p style='color:#8E8E8E;font-size:12px;'>本文档由 <span style='text-decoration:none;color:#1abc9c;font-weight:bold;'>"+ m.Publisher +"</span> 生成<span style='float:right'>- _PAGENUM_ -</span></p>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if tempOutputPath, err = filepath.Abs(tempOutputPath); err != nil {
|
if tempOutputPath, err = filepath.Abs(tempOutputPath); err != nil {
|
||||||
|
@@ -65,8 +65,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>公司标识</label>
|
<label>公司标识</label>
|
||||||
<input type="text" class="form-control" name="publisher" value="{{.Model.publisher}}" placeholder="公司名称" disabled>
|
<input type="text" class="form-control" name="publisher" value="{{.Model.Publisher}}" placeholder="公司名称">
|
||||||
<p class="text">导出文档时的标识</p>
|
<p class="text">导出文档PDF文档时显示的页脚</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>描述</label>
|
<label>描述</label>
|
||||||
|
Reference in New Issue
Block a user