修改 pdf 的生成步骤
This commit is contained in:
parent
305ab5c526
commit
a71916a8f2
BIN
AirTransmission-API-Doc.pdf
Normal file
BIN
AirTransmission-API-Doc.pdf
Normal file
Binary file not shown.
BIN
api_doc.pdf
BIN
api_doc.pdf
Binary file not shown.
17
docfx.json
17
docfx.json
@ -26,6 +26,7 @@
|
||||
"docs/**.md",
|
||||
"docs/**/toc.yml",
|
||||
"toc.yml",
|
||||
"*.yml",
|
||||
"*.md"
|
||||
]
|
||||
}
|
||||
@ -49,15 +50,17 @@
|
||||
}
|
||||
],
|
||||
"dest": "_site",
|
||||
"globalMetadataFiles": [],
|
||||
"fileMetadataFiles": [],
|
||||
"globalMetadata": {
|
||||
"_appTitle": "大气传输计算库",
|
||||
"_appName": "AirTransmission",
|
||||
"_appFooter": "大气传输计算库 API 文档",
|
||||
"_enableSearch": true,
|
||||
"_lang": "zh-CN",
|
||||
"_disableContribution": true
|
||||
},
|
||||
"template": [
|
||||
"default"
|
||||
],
|
||||
"postProcessors": [],
|
||||
"noLangKeyword": false,
|
||||
"keepFileLink": false,
|
||||
"cleanupCacheHistory": false,
|
||||
"disableGitFeatures": false
|
||||
"markdownEngineName": "markdig"
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
{
|
||||
"pdf": {
|
||||
"content": [
|
||||
{
|
||||
"files": [
|
||||
"api/**.yml",
|
||||
"docs/usage_examples.md"
|
||||
],
|
||||
"exclude": [
|
||||
"**/toc.yml",
|
||||
"**/toc.md"
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "AirTransmission-API-Doc",
|
||||
"title": "大气传输计算库 API 文档",
|
||||
"coverPage": {
|
||||
"title": "大气传输计算库",
|
||||
"author": "田建勇",
|
||||
"version": "v1.0.0",
|
||||
"date": "2024年3月"
|
||||
},
|
||||
"wkhtmltopdf": {
|
||||
"additionalArguments": "--enable-local-file-access"
|
||||
},
|
||||
"outputFolder": "_site_pdf"
|
||||
}
|
||||
}
|
||||
@ -65,14 +65,13 @@ Console.WriteLine($"激光透过率: {transmittance:F4}");
|
||||
|
||||
## 许可证
|
||||
|
||||
本项目采用 MIT 许可证。详情请见 [LICENSE](LICENSE) 文件。
|
||||
本项目采用 MIT 许可证。
|
||||
|
||||
## 联系方式
|
||||
|
||||
如有任何问题或建议,请通过以下方式联系我们:
|
||||
|
||||
- 电子邮件:<11429339@qq.com>
|
||||
- 项目 Issues:<https://github.com/11429339/atmospheric-transmittance-model/issues>
|
||||
|
||||
## 致谢
|
||||
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
/* 隐藏目录切换按钮 */
|
||||
.sideaffix,
|
||||
.sidetoc,
|
||||
.toc-filter,
|
||||
#toc_filter_input,
|
||||
.toc-toggle,
|
||||
button[data-toggle="toc"] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏导航按钮 */
|
||||
.mobile-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏顶部导航栏 */
|
||||
.navbar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏面包屑导航 */
|
||||
.subnav {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 移除文档内容的左边距 */
|
||||
.article {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
/* 隐藏页脚 */
|
||||
.footer {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏所有导航相关元素 */
|
||||
.nav,
|
||||
.nav-tabs,
|
||||
.navigation,
|
||||
.pull-right,
|
||||
.toggle-mode {
|
||||
display: none !important;
|
||||
}
|
||||
@ -15,7 +15,13 @@
|
||||
|
||||
## 生成步骤
|
||||
|
||||
1. 首先生成 API 文档的 HTML 文件:
|
||||
1. 首先生成 API 元数据:
|
||||
|
||||
```bash
|
||||
docfx metadata docfx.json
|
||||
```
|
||||
|
||||
2. 然后生成 HTML 文档:
|
||||
|
||||
```bash
|
||||
docfx build docfx.json
|
||||
@ -23,123 +29,27 @@
|
||||
|
||||
这会在 `_site` 目录下生成 HTML 文档。
|
||||
|
||||
2. 使用 wkhtmltopdf 将 HTML 文件转换为 PDF:
|
||||
3. 最后使用 wkhtmltopdf 将 HTML 文件转换为 PDF:
|
||||
|
||||
```bash
|
||||
wkhtmltopdf --enable-local-file-access \
|
||||
_site/api/AirTransmission.html \
|
||||
_site/api/AirTransmission.WeatherType.html \
|
||||
_site/api/AirTransmission.WeatherCondition.html \
|
||||
_site/api/AirTransmission.AtmosphericTransmittanceCalculator.html \
|
||||
api_doc.pdf
|
||||
wkhtmltopdf --enable-local-file-access --page-size A4 --margin-top 20 --margin-bottom 20 --margin-left 20 --margin-right 20 --footer-left "大气传输计算库 API 文档" --footer-right "[page]/[topage]" --footer-spacing 8 --footer-font-size 8 --no-header-line _site/docs/introduction.html _site/docs/usage_examples.html _site/api/AirTransmission.AtmosphericTransmittanceCalculator.html _site/api/AirTransmission.WeatherCondition.html _site/api/AirTransmission.WeatherType.html AirTransmission-API-Doc.pdf
|
||||
```
|
||||
|
||||
## PDF 格式优化选项
|
||||
## 命令参数说明
|
||||
|
||||
如果需要优化 PDF 输出效果,可以添加以下 wkhtmltopdf 参数:
|
||||
|
||||
1. 页面大小和方向:
|
||||
|
||||
```bash
|
||||
--page-size A4 --orientation Portrait
|
||||
```
|
||||
|
||||
2. 页边距(单位:毫米):
|
||||
|
||||
```bash
|
||||
--margin-top 20 --margin-bottom 20 --margin-left 20 --margin-right 20
|
||||
```
|
||||
|
||||
3. 添加页眉页脚:
|
||||
|
||||
```bash
|
||||
--header-center "[page]/[topage]" \
|
||||
--header-line \
|
||||
--footer-center "大气传输计算库 API 文档" \
|
||||
--footer-line \
|
||||
--footer-spacing 10 \
|
||||
--footer-font-size 8
|
||||
```
|
||||
|
||||
4. 封面和目录:
|
||||
|
||||
```bash
|
||||
cover _site/docs/introduction.html \
|
||||
toc --toc-header-text "目录"
|
||||
```
|
||||
|
||||
5. 自定义样式:
|
||||
|
||||
```bash
|
||||
--user-style-sheet docs/custom.css
|
||||
```
|
||||
|
||||
自定义样式文件 `custom.css` 的内容:
|
||||
```css
|
||||
/* 隐藏目录切换按钮 */
|
||||
.sideaffix {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏导航按钮 */
|
||||
.mobile-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏顶部导航栏 */
|
||||
.navbar {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 隐藏面包屑导航 */
|
||||
.subnav {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 移除文档内容的左边距 */
|
||||
.article {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
/* 隐藏页脚 */
|
||||
.footer {
|
||||
display: none !important;
|
||||
}
|
||||
```
|
||||
|
||||
完整的优化命令示例:
|
||||
|
||||
```bash
|
||||
wkhtmltopdf \
|
||||
--enable-local-file-access \
|
||||
--page-size A4 \
|
||||
--orientation Portrait \
|
||||
--margin-top 20 \
|
||||
--margin-bottom 20 \
|
||||
--margin-left 20 \
|
||||
--margin-right 20 \
|
||||
--header-center "[page]/[topage]" \
|
||||
--header-line \
|
||||
--footer-center "大气传输计算库 API 文档" \
|
||||
--footer-line \
|
||||
--footer-spacing 10 \
|
||||
--footer-font-size 8 \
|
||||
--user-style-sheet docs/custom.css \
|
||||
cover _site/docs/introduction.html \
|
||||
toc --toc-header-text "目录" \
|
||||
_site/docs/usage_examples.html \
|
||||
_site/api/AirTransmission.html \
|
||||
_site/api/AirTransmission.WeatherType.html \
|
||||
_site/api/AirTransmission.WeatherCondition.html \
|
||||
_site/api/AirTransmission.AtmosphericTransmittanceCalculator.html \
|
||||
api_doc.pdf
|
||||
```
|
||||
- `--enable-local-file-access`: 允许访问本地文件
|
||||
- `--page-size A4`: 设置页面大小为 A4
|
||||
- `--margin-top/bottom/left/right 20`: 设置页边距为 20mm
|
||||
- `--footer-left`: 设置页脚左侧文本
|
||||
- `--footer-right`: 设置页脚右侧文本(页码)
|
||||
- `--footer-spacing`: 设置页脚间距
|
||||
- `--footer-font-size`: 设置页脚字体大小
|
||||
- `--no-header-line`: 不显示页眉分隔线
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. 确保所有的 HTML 文件都已经正确生成
|
||||
2. 如果遇到路径问题,请使用完整的文件路径
|
||||
3. 如果文档包含中文,确保系统安装了相应的中文字体
|
||||
4. 生成的 PDF 文件默认保存在当前目录下
|
||||
5. 封面页不会显示页眉和页脚
|
||||
6. 自定义样式可以隐藏不需要的 HTML 元素
|
||||
1. 必须按顺序执行上述三个步骤
|
||||
2. 确保所有的 HTML 文件都已经正确生成
|
||||
3. 如果遇到路径问题,请使用完整的文件路径
|
||||
4. 如果文档包含中文,确保系统安装了相应的中文字体
|
||||
5. 生成的 PDF 文件默认保存在当前目录下
|
||||
|
||||
25
docs/toc.yml
25
docs/toc.yml
@ -1,25 +0,0 @@
|
||||
- name: 使用示例
|
||||
href: usage_examples.md
|
||||
- name: 大气透过率计算器
|
||||
href: api/AirTransmission.AtmosphericTransmittanceCalculator.yml
|
||||
- name: 天气条件
|
||||
href: api/AirTransmission.WeatherCondition.yml
|
||||
- name: 传输模型
|
||||
items:
|
||||
- name: 基础模型
|
||||
href: api/AirTransmission.TransmittanceModel.yml
|
||||
- name: 激光传输模型
|
||||
href: api/AirTransmission.LaserTransmittanceModel.yml
|
||||
- name: 红外传输模型
|
||||
href: api/AirTransmission.IRTransmittanceModel.yml
|
||||
- name: 紫外传输模型
|
||||
href: api/AirTransmission.UVTransmittanceModel.yml
|
||||
- name: 毫米波传输模型
|
||||
href: api/AirTransmission.MillimeterWaveTransmittanceModel.yml
|
||||
- name: 大气湍流模型
|
||||
href: api/AirTransmission.AtmosphericTurbulenceModel.yml
|
||||
- name: API 文档
|
||||
href: api/
|
||||
homepage: api/AirTransmission.html
|
||||
- name: PDF 生成指南
|
||||
href: generate_pdf.md
|
||||
@ -1,10 +0,0 @@
|
||||
apiRules:
|
||||
- include:
|
||||
uidRegex: ^AirTransmission
|
||||
type: Namespace
|
||||
- include:
|
||||
uidRegex: ^AirTransmission\..*
|
||||
type: Type
|
||||
- include:
|
||||
uidRegex: ^AirTransmission\..*
|
||||
type: Member
|
||||
18
toc.yml
18
toc.yml
@ -1,2 +1,18 @@
|
||||
### YamlMime:TableOfContent
|
||||
metadata:
|
||||
pdf:
|
||||
enabled: true
|
||||
fileName: AirTransmission-API-Doc.pdf
|
||||
items:
|
||||
- name: 简介
|
||||
href: docs/introduction.md
|
||||
- name: 使用示例
|
||||
href: docs/usage_examples.md
|
||||
- name: API 文档
|
||||
href: docs/
|
||||
items:
|
||||
- name: 大气透过率计算器
|
||||
href: api/AirTransmission.AtmosphericTransmittanceCalculator.yml
|
||||
- name: 天气条件
|
||||
href: api/AirTransmission.WeatherCondition.yml
|
||||
- name: 天气类型
|
||||
href: api/AirTransmission.WeatherType.yml
|
||||
Loading…
Reference in New Issue
Block a user