[reportlab-users] Setting TrueType fonts in table cell
Tim Roberts
timr at probo.com
Thu Sep 26 12:29:33 EDT 2013
Nils Smeds wrote:
> Here is a simple test case:
> Modify the base_style array as indicated to expose the problem I see.
I can give you a workaround for this, although it is somewhat unsatisfying.
The root of the issue, I think, is that you have a document serving two
masters. You are using SimpleDocTemplate to create a document object.
That document object expects to be in charge. When you call "build", he
does the drawing, he does a showPage, and he does a saveFile. He thinks
he's done. Then, you go fetch his canvas, do additional drawing, do
another showPage and another saveFile. At that point, the fonts get
enumerated again and confusion results.
To work around this problem, you can just tell the document to forget
about the fonts it already handled. So, add one line:
PDFdoc.build(PDCdoc_elements)
PDFcanvas=PDFdoc.canv
PDFcanvas._doc.delayedFonts = [] # <<<
I'm afraid I will have to leave it to the ReportLab folks to figure out
whether this is preventable, or if this is a usage problem.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users
mailing list