paul, or any other reportlab expert,

Trying to write a simple txt2pdf routine.  got close, but CR's are not doing 
what I want them to do.  I understand why, just wondering what the solution to 
this previously solved problem is.

I have been looking at http://www.reportlab.com/pp_demo.html like pages, and 
can't find anything this simple.

thanks,
Carl K

# txt2pdf.py

import glob
from reportlab.pdfgen import canvas
from reportlab.lib.units import inch

font = "Helvetica"
font_size = 26
x = 5.0 * inch
y = 8.0 * inch

files = glob.glob('*.txt')
print files

for filename in files:
        print filename
        text = open(filename).read()
        print len(text)
        destination_file = filename[:-4] + ".pdf"
        print destination_file
        my_canvas = canvas.Canvas(destination_file)
        my_canvas.setFont(font, font_size)
        my_canvas.drawRightString(x, y, text)
        my_canvas.save()

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to