Login

Snippets by vsergeyev

Snippet List

pyText2Pdf - Python script to convert plain text into PDF file. Modified to work with streams.

This is "pyText2Pdf" - Python script to convert plain text into PDF file. Originally written by Anand B Pillai. It is taken from http://code.activestate.com/recipes/189858/ Modified to work with streams. Example: produce PDF document from text and output it as HTTPResponse object. import StringIO input_stream = StringIO.StringIO(text) result = StringIO.StringIO() pdfclass = pyText2Pdf(input_stream, result, "PDF title") pdfclass.Convert() response = HttpResponse(result.getvalue(), mimetype="application/pdf") response['Content-Disposition'] = 'attachment; filename=pdf_report.pdf' return response

  • django
  • tools
  • python
  • pdf
  • converter
  • text2pdf
  • adobe
  • acrobat
  • processing
Read More

vsergeyev has posted 2 snippets.