2

I'm generating some PDFs and sometimes the User Input is too long to fit into a table cell. So at certain spots, I just truncated Strings longer than x characters. But that is always a guess. Is there any way to figure out what size a certain text will be printed?

my document looks a bit liks this:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Helvetica">

<fo:table table-layout="fixed" width="200mm">
 <fo:table-column column-width="20mm"/>
 <fo:table-column column-width="25mm"/>
 ...
 <fo:table-body>
  <fo:table-row>
   <fo:table-cell border="black 1pt solid"  padding="0.6mm 1mm 0.5mm 1mm">
    <fo:block  text-align="right"  font-weight="bold"  font-size="8.4pt">Name:</fo:block>
   </fo:table-cell>
   <fo:table-cell  border="black 1pt solid"  padding="0.6mm 1mm 0.5mm 1mm">
    <fo:block  text-align="left"  font-weight="normal"  font-size="8.4pt">FirstName LastName</fo:block>
   </fo:table-cell>
   ...
  </fo:table-row>

and I'd like to know in advance if "FirstName LastName" will fit into the 25mm when rendered.

EasterBunnyBugSmasher
  • 1,507
  • 2
  • 15
  • 34

0 Answers0