« Return to Thread: [bug report] - Vertical rotated text missing the last character in PdfPTable

[bug report] - Vertical rotated text missing the last character in PdfPTable

by Gregan, Miroslav :: Rate this Message:

Reply to Author | View in Thread

Hi all,
 
as you can see in the example, I'm using iText 2.1.6.
I'm trying to write vertical texts without wrapping in a PdfPTable.
The problem is that the last VAVAVAVAVA's "A" is missing in the rendered PDF. 
Maybe it is due to the font's kerning?
 
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(" C:\\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( 3 );
   mainTable.getDefaultCell().setNoWrap(true);
 
   float[] columnWidths = {  90f, 16f, 16f };
   String[] columnContent = { document.getVersion(), "VAVAVAVAVA", "TOTOYOTOT"};
   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());
   }
  }
 }
}


------------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
iText-questions@...
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/

test.pdf (15K) Download Attachment

 « Return to Thread: [bug report] - Vertical rotated text missing the last character in PdfPTable