[reportlab-users] Crop text outside frame?
Wed, 21 May 2003 15:18 +0100 (BST)
> If my flowable doesn't wrap (Preformatted perhaps) inside a small frame,
> the text prints outside (right side) the frame. I really don't
> how to deal with that... I just want to crop everything outside the
> frame... Is that possible?
> I can myself see two possibilities:
> 1) Cut the textstring. But I can't know tha actual width of it. I must
> approximate that all characters are very wide ("W" or "M"), but I can't
> really know.
You could try using something like :
from reportlab.pdfbase.pdfmetrics import getFont
myfont = 'Helvetica-Bold'
size = 12
maxwid = getFont(myfont).stringWidth(mylongstring, size)
> 2) Print a new frame to the right of the frame. Thus overprint the ugly
> /Erik Starbäck
Forestfield Software Ltd