有没有直接的方法可以通过python从markdown文件生成pdf [英] Is there any direct way to generate pdf from markdown file by python

查看:458
本文介绍了有没有直接的方法可以通过python从markdown文件生成pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为标题,我想使用markdown作为主要写入格式,并且需要使用纯python从markdown生成PDF文件.

As the title, I want to use markdown as my main write format and I need to generate PDF files from markdown using pure python.

推荐答案

我已经完成,并将分两步完成.首先,我将使用 python-markdown 从Markdown中提取HTML,然后我将d使用 xhtml2pdf 制作PDF文件.

I have done and would do it in two steps. First, I'd use python-markdown to make HTML out of my Markdown, and then I'd use xhtml2pdf to make a PDF file.

编辑(2014):

如果我现在正在执行此操作,则可以选择 WeasyPrint 作为我的HTML-to-PDF工具;它做得很好,最近我在几个项目中使用了它.

If I were doing this now, I might choose WeasyPrint as my HTML-to-PDF tool; it does a beautiful job, and I've used it on a couple projects recently.

这篇关于有没有直接的方法可以通过python从markdown文件生成pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆