Here is my try to change character spacing in a PdfPTable's cell when using
PdfPTable#writeSelectedRows(..., PdfContentByte canvas):


  PdfContentByte canvas=writer.getDirectContent();
  PdfPTable t = new PdfPTable(1);
  t.setTotalWidth(40f);
  PdfPCell cell = new PdfPCell( 
               new Phrase("This is a long text will be wrapped in the cell. ") 
);
  t.add( cell );
  
  // change character spacing
  canvas.setCharacterSpacing( 2.5f);
  t.writeSelectedRows(0, 1, 0, 0, canvas);

Though spacing between characters is indeed expanded, but text is wrapped 
incorrectly and parts of text being truncated.
See http://fengdh.googlepages.com/characterspacinginacell.PNG

I have also debuged into PdfPTable#getTotalHeight(), which calls 
ColumnText#go(true), in that case it seemd text is wrapped in a
correct way.

How can I fix this probelm?

Yours sincerely,
Feng Dihai
  


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to