Skip to content

Commit

Permalink
优化PDF生成命令,优化排版,减少章节内不必要的过多的空白区域,fix PDF底部的样式bug
Browse files Browse the repository at this point in the history
  • Loading branch information
liuguangw committed Sep 8, 2018
1 parent 7583503 commit aa17483
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@echo off
set header_tpl="<div style=\"padding:12px 0;width:100%;overflow:hidden;border-bottom: 1px solid #eee;color: #5c6163;font-size:14px;\"><div style=\"float:right;\">µÚ_PAGENUM_Ò³</div><div>_SECTION_</div></div>"
set header_tpl="<div style=\"margin:12px 0;padding-bottom: 10px;width:100%;overflow:hidden;border-bottom: 1px solid #eee;color: #5c6163;font-size:14px;\"><div style=\"float:right;\">第 _PAGENUM_ 页</div><div>_SECTION_</div></div>"
set footer_tpl="<div style=\"margin:12px 0;padding-top: 10px;width:100%;overflow:hidden;border-top: 1px solid #eee;color: #5c6163;font-size:14px;\"><div style=\"float:right;\">第 _PAGENUM_ 页</div><div>_SECTION_</div></div>"
set is_debug=0
set inputFile=all.html
set outputFile=laravel56_doc_zh_cn.pdf
Expand All @@ -8,6 +9,11 @@ if %is_debug% equ 1 (
set outputFile=debug.pdf
)
cd html_files
echo "%inputFile% ------ %outputFile%"
ebook-convert "%inputFile%" "../%outputFile%" -v --paper-size=a4 --breadth-first --level1-toc=//h:h1 --level2-toc=//h:h2 --level3-toc=//h:h3 --authors="Á÷¹â" --pdf-page-margin-left=18 --pdf-page-margin-right=18 --pdf-header-template=%header_tpl% --pdf-footer-template=%header_tpl%
echo "%inputFile% ------ %outputFile%"
set metaOption=--title "laravel 5.6 中文文档" --authors="流光" --comments="本PDF文档由流光整理制作 [https://github.com/liuguangw/laravel_doc]"
set commonOption=--language=zh-hans --chapter-mark=pagebreak --page-breaks-before=/ --paper-size=a4 --breadth-first
set tocOption=--level1-toc=//h:h1 --level2-toc=//h:h2 --level3-toc=//h:h3
set marginOption=--pdf-page-margin-left=18 --pdf-page-margin-right=18 --pdf-page-margin-top=38 --pdf-page-margin-bottom=38
set templateOption=--pdf-header-template=%header_tpl% --pdf-footer-template=%footer_tpl%
ebook-convert "%inputFile%" "../%outputFile%" -v %commonOption% %tocOption% %marginOption% %templateOption% %metaOption%
cd ..

0 comments on commit aa17483

Please sign in to comment.