Sphinx生成PDF

https://zh-sphinx-doc.readthedocs.io/en/latest/tutorial.html
https://www.ibm.com/developerworks/cn/opensource/os-sphinx-documentation/

1、安装Anaconda for python 2.7 √
2、安装sphinx √
3、配置python、sphinx-quickstart环境变量 √
4、安装pdfrw库 √
5、安装rst2pdf库  √   ##其他插件http://www.sphinx-doc.org/en/stable/extensions.html
6、使用make pdf命令 √(此处不要使用make latexpdf命令)
7、添加中文内容 (已含中文字体) √   
http://www.hankcs.com/program/python/the-use-of-rst2pdf-to-expand-sphinx-to-generate-pdf.html
http://sphinx-users.jp/cookbook/pdf/rst2pdf.html
http://www.typemylife.com/sphinx-restructuredtext-pdf-generation-with-rst2pdf/



8、添加图片 √
9、中文内容排版  √
http://blog.csdn.net/weishantc/article/details/46729103
10、完整输出一份中文PDF报告
http://zh-sphinx-doc.readthedocs.io/en/latest/contents.html


pdf_language = 'zh_CN'
pdf_stylesheets = ['zh_CN']
pdf_font_path = ['C:\\Windows\\Fonts']


在Python27\Lib\site-packages\rst2pdf\findfonts.py第236行加入如下代码
fontfile = get_nt_fname(fname)
后面加了一句:
fontfile = 'C:\\Windows\\Fonts\\simsun.ttc'
zh_CN.json文件中的字体统一调成simsun


将常用字体放到C:\windows\Fonts目录下
将中文配置成zh_cn.style文件,比放置到D:\Program Files\Python27\Lib\site-packages\rst2pdf\styles下


embeddedFonts用于嵌入字体,经试验,必须包含至少四个值才不会报错。不过这四个字体值可以是重复的。

fontsAlias用来指定各类字形用什么字体。如stdFont指正文字体,stdBold指粗体,stdItalic指斜体。其他的还有stdBoldItalic粗斜体,stdMono等宽体,等等。
确保所用字体已经安装在你的操作系统上,且字体必须是TTF类型的(Windows环境下限制比较多~)。
wordWrap用于指定换行规则,CJK就是适用于中日韩文字的规则。


##名称,标题,作者相关说明
https://www.quora.com/How-to-create-a-PDF-out-of-Sphinx-documentation-tool

#############################
##官方文档
http://www.sphinx-doc.org/en/stable/contents.html

##中文入门
http://www.pythondoc.com/sphinx/rest.html#id15

##中文文档
http://zh-sphinx-doc.readthedocs.io/en/latest/contents.html







################################################################
http://blog.csdn.net/meseal/article/details/52063632
http://www.jb51.net/article/86046.htm
http://www.hankcs.com/program/python/the-use-of-rst2pdf-to-expand-sphinx-to-generate-pdf.html

http://www.jb51.net/article/86046.htm



新建一个文件夹,点住shift,再点右键,在此处打开命令窗口



extensions = ['sphinx.ext.autodoc', 'rst2pdf.pdfbuilder']
pdf_documents = [('index', u'rst2pdf', u'Sample rst2pdf doc', u'Your Name'),]
   
# index - master document
# rst2pdf - name of the generated pdf
# Sample rst2pdf doc - title of the pdf
# Your Name - author name in the pdf




转载于:https://my.oschina.net/kyo4321/blog/1524615

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值