I want to avoid a line break in a table cell.
So my Idea is to calculate the String width of a cell and cut the String
even if its longer.
so it works for my like this :
PDFGraphics2D pdfgrafics2d = new PDFGraphics2D(false);
fontmetrics = pdfgrafics2d.getFontMetrics(new
Font(FOPTelefonTable.FONT_FAMILY ,Font.PLAIN,new
Integer(FOPTelefonTable.FONT_SIZE_PT).intValue()));
private String cutName(FontMetrics fontmetrics,String source) {
String result = source;
if (fontmetrics.stringWidth(result) <= MAX_NAME_WIDTH_PX) return result;
while (fontmetrics.stringWidth(result) > MAX_NAME_WIDTH_PX) {
result = result.substring(0,result.length()-1);
}
return result;
}
But it seems so that the calculatet width from
fontmetrics.stringWidth
ist not the width that i can see in the generatet PDF
Have someone a better Idea to calculate the width ?
Thanks JK
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]