开发者

generate pdf from text file in python

Is there a solution to create pdf file from txt, maybe in ReportLab? To produce like this

+------+-------+------------+
| Name |  Age  |  Nickname  |
+======+=======+开发者_StackOverflow中文版============+
| 107  |  Ella | Fitzgerald |
+------+-------+------------+
| 108  | Louis | Armstrong  |
+------+-------+------------+
| 109  | Miles |   Davis    |
+------+-------+------------+
| 110  | Benny |  Goodman   |
+------+-------+------------+

Thanks.


ReportLab is an option. LaTeX is another option.


EMACS org mode make this task exceedingly simple. Org makes it easy to format tables in plain ASCII. Any line with ‘|’ as the first non-whitespace character is considered part of a table. ‘|’ is also the column separator.

C-c C-e p (org-export-as-pdf) Export as LaTeX and then process to PDF.


Pisa generates from html. It's very easy to use.

http://www.xhtml2pdf.com/ http://www.20seven.org/journal/2008/11/pdf-generation-with-pisa-in-django.html http://antydba.blogspot.com/search/label/django%20pisa%20html2pdf%20polskie%20czcionki

import ho.pisa as pisa
import cStringIO as StringIO

result = StringIO.StringIO()
pdf = pisa.pisaDocument(StringIO.StringIO("<table><tr><td>test test</td></tr></table>"), result)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜