[reportlab-users] windows platypus problem
Andrey Khavryuchenko
akhavr at kds.com.ua
Fri Aug 26 12:42:59 EDT 2005
Hi!
I'm trying to use platypus to handle my pdf output using custom TTF fonts.
But the pdf I get is empty (nothing is shown).
The same script under linux (with font path adjusted) works flawlesly.
What I'm doing wrong?
Here's my script:
import copy
from cStringIO import StringIO
import reportlab
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab import platypus
pdfmetrics.registerFont(
TTFont('Times',
'/windows/fonts/times.ttf' ))
styles = reportlab.lib.styles.getSampleStyleSheet()
string = 'Test Nonsense'
para = platypus.Paragraph(string, styles["Normal"])
fp = StringIO()
doc_tmpl = platypus.BaseDocTemplate( fp, pagesize=(595,841),
showBoundary=0,
leftMargin=0.5,
rightMargin=0.5,
topMargin=0.5,
bottomMargin=0.5,
title="test document",
author="Andrey V Khavryuchenko",
allowSplitting=20)
frames = [ platypus.Frame( x1=56.69,
y1=56.69,
width=482,
height=709 ) ]
page_templates = [ platypus.PageTemplate(frames=frames) ]
doc_tmpl.addPageTemplates(page_templates)
doc_tmpl.build([para])
open('t.pdf','w').write(fp.getvalue())
Thanks in advance!
--
Andrey V Khavryuchenko http://www.kds.com.ua/
Silver Bullet Software Solutions http://www.livejournal.com/~akhavr
More information about the reportlab-users
mailing list