开发者

Creating a PDF from XML using XSL FO w/ Python

开发者 https://www.devze.com 2023-02-22 19:54 出处:网络
Could someone point me in the right direction of ho开发者_Go百科pefully a library or code examples, any resources on how to take XML and create a PDF using XSL-FO in Python? If I should have to use an

Could someone point me in the right direction of ho开发者_Go百科pefully a library or code examples, any resources on how to take XML and create a PDF using XSL-FO in Python? If I should have to use an XML renderer, then which XML renderer is recommended?


If you want to run XSLT programmatically with Python, you want lxml.

However, if you just need to create a .fo file from a defined XSL/XML pair, you might as well just use xsltproc, which is available on any Unix-y system on the command line, including OS X.

Once you have the .fo file, use Fop to transform that to PDF.


You may want to try XHTML2PDF. It's very easy to use. Create your XHTML template. Use Jinja2 (or similar) to fill in the template. Convert to PDF.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号