简体   繁体   中英

Crop text if longer than Cell Width in fPDF?

I have a cell in fPDF which is 50mm wide which is populated from a field in a database. Is there a way I can crop the text so that it doesn't go beyond 50mm if the field contains a lot of text?

Alternatively is there a way in PHP to crop a string based on it's mm length when printed at a specific font size?

A Cell of size 100mm can contains approx 75 character of font size 8. So Try to get your adject text length by manually with above hint.

But What I suggest better use MultiCell() for dynamic text size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM