Пример #1
0
def create_rtf(matiere):
    
    httpResponse = render_to_response('coeur/matiere_rtf.html', {'matiere'      : matiere,
                                                     })
    filename = '/tmp/rtf/%s %s.rtf' % (matiere.promotion, matiere.titre)
    f = open(filename, 'w')
    doc = XHTMLReader.read(httpResponse.content, "")
    Rtf15Writer.write(doc , f)
    
    return filename
Пример #2
0
from pyth.plugins.xhtml.reader import XHTMLReader
from pyth.plugins.rtf15.writer import Rtf15Writer
import sys

if len(sys.argv) > 1:
    filename = sys.argv[1]
else:
    filename = "tests/html/sample-with-image.html"
source = open(filename, "rb")
doc = XHTMLReader.read(source)

print Rtf15Writer.write(doc).getvalue()
Пример #3
0
from pyth.plugins.rtf15.writer import Rtf15Writer
import pythonDoc

doc = pythonDoc.buildDoc()

print Rtf15Writer.write(doc).getvalue()