Can anyone recommend a decent FOSS PDF generator for Python?

删除回忆录丶 提交于 2019-12-05 12:05:14
bouvard

For one of my projects, I have tested and/or implemented probably six or seven different methods of going from an image to a PDF in the last six months. Ultimately I ended up coming back to ReportLab (which I had initially avoided for reasons similar to those you described) because all of the others had glaring limitations or outright omissions (such as the inability to set document metadata).

ReportLab isn't as difficult to handle as it appears at first glance and it may save you a lot of headache-laden refactoring later on. I would strongly suggest you go ahead and use it and therefore know that if you ever want to be able to do more you will have the ability too rather than do what I did and bounce back and forth between a number of different utilities, libraries, and formats.

EDIT:

It is also worth mentioning that you can bypass the Platypus layout system that comes with ReportLab if all you want to do is put bit a of text and imagery on a page.

I think going through Latex is the easiest way, and not overkill at all. Generating a working PDF file is quite a difficult activity, whereas generating a Tex source is much easier. Any other typesetting change would probably work as well, such as going through reStructuredText or troff.

Is the reportlab code not ok? The reason why using LaTeX might not be overkill is because pdf is a really low-level format. In pdf you do not get line-breaks automatically, you have to calculate line-widths yourself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!