Hi all
I was looking forward to test the new release and actually the test case
I sent you work (AAA1, BBB1).
But I found other strings that still don't, maybe it is due to the
font's kerning?
For example if you replace "AAA1" by "VAVAVAVAVA" and "BBB1" by
"TOTOYOTOT" the last VAVAVAVAVA's A will be missing in the PDF.
Thank you.
Kind regards,
Miro
Gregan, Miroslav wrote:
> Hi all,
>
> When writing text rotated to 90`, it happen that sometimes the last
> character is not written.
> For example in this PDF there should be "AAA1" in the table instead of
> "AAA".
>
> Do you have any clue
If I add the text "AAA1" with font Tahoma and font size 12 to a
ColumnText, iText tells me the with is 28.103973 pt.
If I ask the BaseFont Tahoma for the width of the same String, I get
28.104 pt. In other words: the problem is smaller than a 10,000th of a
point.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
________________________________
From: Gregan, Miroslav
Sent: Wednesday, April 15, 2009 4:46 PM
To: '[email protected]'
Subject: Vertical rotated text missing the last character in PdfPTable
Hi all,
When writing text rotated to 90`, it happen that sometimes the last
character is not written.
For example in this PDF there should be "AAA1" in the table instead of
"AAA".
Do you have any clue how to have the expected content?
Thank you.
Kind regards,
Miro
PS I'm testing the following code:
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.PageSize;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class Test {
public static void main(String[] args) {
FontFactory.register("C:\\WINNT\\Fonts\\tahoma.ttf");
Font fontNormal = FontFactory.getFont("Tahoma", BaseFont.IDENTITY_H,
9f);
Document document = null;
FileOutputStream fileOutputStream = null;
PdfWriter pdfWriter = null;
try {
document = new Document(PageSize.A4);
fileOutputStream = new
FileOutputStream("D:\\FU20-Tool\\testWorkspace\\test.pdf");
pdfWriter = PdfWriter.getInstance(document, fileOutputStream);
} catch (DocumentException de) {
System.out.println(de.toString());
} catch (FileNotFoundException fnfe) {
System.out.println(fnfe.toString());
}
if ((document != null) && (fileOutputStream != null) && (pdfWriter !=
null)) {
document.open();
PdfPTable mainTable = new PdfPTable(4);
mainTable.getDefaultCell().setNoWrap(true);
float[] columnWidths = { 70f, 16f, 16f, 16f };
String[] columnContent = { "ABC1", "AAA1", "BBB1", "CCC"};
try {
mainTable.setTotalWidth(columnWidths);
} catch (DocumentException e) {
System.out.println(e.toString());
}
mainTable.addCell(new Phrase(columnContent[0], fontNormal));
mainTable.getDefaultCell().setRotation(90);
for (int i = 1; i < columnContent.length; i++) {
mainTable.addCell(new Phrase(columnContent[i], fontNormal));
}
mainTable.writeSelectedRows(0, -1, 2f, PageSize.A4.getHeight()-2f,
pdfWriter.getDirectContent());
document.close();
try {
fileOutputStream.close();
} catch (IOException e) {
System.out.println(e.toString());
}
}
}
}
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/