<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FPDF%2FTable_Cell</id>
		<title>Java Tutorial/PDF/Table Cell - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FPDF%2FTable_Cell"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/PDF/Table_Cell&amp;action=history"/>
		<updated>2026-04-07T00:48:54Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/PDF/Table_Cell&amp;diff=5586&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/PDF/Table_Cell&amp;diff=5586&amp;oldid=prev"/>
				<updated>2010-06-01T05:21:57Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 05:21, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/PDF/Table_Cell&amp;diff=5585&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/PDF/Table_Cell&amp;diff=5585&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  Add content to table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.PageSize;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document(PageSize.A4);&lt;br /&gt;
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(3);&lt;br /&gt;
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);&lt;br /&gt;
    table.addCell(&amp;quot;the quick brown fox&amp;quot;);&lt;br /&gt;
    table.addCell(&amp;quot;the quick brown fox&amp;quot;);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Add paragraph of first line indented to a table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    Paragraph p = new Paragraph(&amp;quot;.&amp;quot;);&lt;br /&gt;
    cell = new PdfPCell(p);&lt;br /&gt;
    cell.setIndent(20);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;extra indentation (paragraph)&amp;quot;);&lt;br /&gt;
    p.setFirstLineIndent(10);&lt;br /&gt;
    cell = new PdfPCell();&lt;br /&gt;
    cell.addElement(p);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Add paragraph to table cell with alignment setting ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    table.addCell(&amp;quot;default alignment&amp;quot;);&lt;br /&gt;
    table.addCell(&amp;quot;paragraph alignment&amp;quot;);&lt;br /&gt;
    Paragraph p1 = new Paragraph(&amp;quot;Quick brown fox&amp;quot;);&lt;br /&gt;
    Paragraph p2 = new Paragraph(&amp;quot;jumps over&amp;quot;);&lt;br /&gt;
    p2.setAlignment(Element.ALIGN_CENTER);&lt;br /&gt;
    Paragraph p3 = new Paragraph(&amp;quot;the lazy dog.&amp;quot;);&lt;br /&gt;
    p3.setAlignment(Element.ALIGN_RIGHT);&lt;br /&gt;
    cell = new PdfPCell();&lt;br /&gt;
    cell.addElement(p1);&lt;br /&gt;
    cell.addElement(p2);&lt;br /&gt;
    cell.addElement(p3);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;extra indentation (cell)&amp;quot;);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Auto Fill Empty cells ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Point;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Table;&lt;br /&gt;
import com.lowagie.text.pdf.PdfContentByte;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    Table table = new Table(2, 2);&lt;br /&gt;
    table.setAlignment(Element.ALIGN_LEFT);&lt;br /&gt;
    table.setAutoFillEmptyCells(true);&lt;br /&gt;
    table.addCell(&amp;quot;0.0&amp;quot;);&lt;br /&gt;
    table.addColumns(2);&lt;br /&gt;
    float[] f = { 2f, 1f, 1f, 1f };&lt;br /&gt;
    table.setWidths(f);&lt;br /&gt;
    table.addCell(&amp;quot;2.2&amp;quot;, new Point(2, 2));&lt;br /&gt;
    table.deleteColumn(2);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Cell border color and background color ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.PageSize;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Rectangle;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document(PageSize.A4.rotate());&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(4);&lt;br /&gt;
    table.setWidthPercentage(100);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;t&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;d&amp;quot;));&lt;br /&gt;
    cell.setBorder(Rectangle.TOP);&lt;br /&gt;
    cell.setUseBorderPadding(true);&lt;br /&gt;
    cell.setBorderWidthTop(5f);&lt;br /&gt;
    cell.setBorderColorTop(Color.cyan);&lt;br /&gt;
    cell.setBackgroundColor(Color.blue);&lt;br /&gt;
        cell.setBorder(Rectangle.BOTTOM);&lt;br /&gt;
    cell.setBorderColorBottom(Color.magenta);&lt;br /&gt;
    cell.setBorderWidthBottom(10f);&lt;br /&gt;
    cell.setBackgroundColor(Color.green);    &lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;r&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;b&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;G:&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;0.25&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;0.5&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;0.75&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;:&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;a&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;b&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;o&amp;quot;));&lt;br /&gt;
    table.addCell(cell);    &lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Change table cell background color ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
      PdfWriter.getInstance(&lt;br /&gt;
          document,&lt;br /&gt;
          new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
      document.open();&lt;br /&gt;
      float[] widths = { 1, 4 };&lt;br /&gt;
      PdfPTable table = new PdfPTable(widths);&lt;br /&gt;
      table.setWidthPercentage(30);&lt;br /&gt;
      PdfPCell cell = new PdfPCell(new Paragraph(&amp;quot;fox&amp;quot;));&lt;br /&gt;
      cell.setBackgroundColor(Color.YELLOW);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;asdf&amp;quot;);&lt;br /&gt;
      document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Image is scaled ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Image;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    Image img = Image.getInstance(&amp;quot;dog.jpg&amp;quot;);&lt;br /&gt;
    PdfPTable table = new PdfPTable(1);&lt;br /&gt;
    table.addCell(img);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  implements PdfPCellEvent ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Phrase;&lt;br /&gt;
import com.lowagie.text.Rectangle;&lt;br /&gt;
import com.lowagie.text.pdf.GrayColor;&lt;br /&gt;
import com.lowagie.text.pdf.PdfContentByte;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCellEvent;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
class RoundRectangle implements PdfPCellEvent {&lt;br /&gt;
  public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) {&lt;br /&gt;
    PdfContentByte cb = canvas[PdfPTable.LINECANVAS];&lt;br /&gt;
    cb.setColorStroke(new GrayColor(0.8f));&lt;br /&gt;
    cb.roundRectangle(rect.left() + 4, rect.bottom(), rect.width() - 8, rect.height() - 4, 4);&lt;br /&gt;
    cb.stroke();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    RoundRectangle border = new RoundRectangle();&lt;br /&gt;
    PdfPTable table = new PdfPTable(6);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    for (int i = 1; i &amp;lt;= 30; i++) {&lt;br /&gt;
      cell = new PdfPCell(new Phrase(&amp;quot;day &amp;quot; + i));&lt;br /&gt;
      cell.setHorizontalAlignment(Element.ALIGN_CENTER);&lt;br /&gt;
      cell.setBorder(Rectangle.NO_BORDER);&lt;br /&gt;
      cell.setPadding(4);&lt;br /&gt;
      cell.setCellEvent(border);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
    }&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Not scaled Image ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Image;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    Image img = Image.getInstance(&amp;quot;dog.jpg&amp;quot;);&lt;br /&gt;
    PdfPTable table = new PdfPTable(1);&lt;br /&gt;
    table.addCell(new PdfPCell(img, false));&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Rotate a table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
      PdfWriter.getInstance(&lt;br /&gt;
          document,&lt;br /&gt;
          new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
      document.open();&lt;br /&gt;
      float[] widths = { 1, 4 };&lt;br /&gt;
      PdfPTable table = new PdfPTable(widths);&lt;br /&gt;
      table.setWidthPercentage(30);&lt;br /&gt;
      PdfPCell cell = new PdfPCell(new Paragraph(&amp;quot;fox&amp;quot;));&lt;br /&gt;
      cell.setRotation(90);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;asdf&amp;quot;);&lt;br /&gt;
      document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Scaled Image with no padding ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Image;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    Image img = Image.getInstance(&amp;quot;dog.jpg&amp;quot;);&lt;br /&gt;
    PdfPTable table = new PdfPTable(1);&lt;br /&gt;
    table.addCell(new PdfPCell(img, true));&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set alignment for Table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    Paragraph p = new Paragraph(&amp;quot;.&amp;quot;);&lt;br /&gt;
    table.addCell(&amp;quot;default alignment&amp;quot;);&lt;br /&gt;
    cell = new PdfPCell(p);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;centered alignment&amp;quot;);&lt;br /&gt;
    cell = new PdfPCell(p);&lt;br /&gt;
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;right alignment&amp;quot;);&lt;br /&gt;
    cell = new PdfPCell(p);&lt;br /&gt;
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;justified alignment&amp;quot;);&lt;br /&gt;
    cell = new PdfPCell(p);&lt;br /&gt;
    cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set leading for table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Phrase;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    table.setWidthPercentage(100);&lt;br /&gt;
    PdfPCell cell = new PdfPCell(new Paragraph(&lt;br /&gt;
        &amp;quot;Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.&amp;quot;));&lt;br /&gt;
    table.addCell(&amp;quot;default leading / spacing&amp;quot;);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;absolute leading: 20&amp;quot;);&lt;br /&gt;
    cell.setLeading(20f, 0f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;absolute leading: 3; relative leading: 1.2&amp;quot;);&lt;br /&gt;
    cell.setLeading(3f, 1.2f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;absolute leading: 0; relative leading: 1.2&amp;quot;);&lt;br /&gt;
    cell.setLeading(0f, 1.2f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;no leading at all&amp;quot;);&lt;br /&gt;
    cell.setLeading(0f, 0f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set left, right, top and bottom padding for table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Phrase;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    table.setWidthPercentage(100);&lt;br /&gt;
    PdfPCell cell = new PdfPCell(new Paragraph(&lt;br /&gt;
        &amp;quot;Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.&amp;quot;));&lt;br /&gt;
    table.addCell(&amp;quot;different padding for left, right, top and bottom&amp;quot;);&lt;br /&gt;
    cell.setPaddingLeft(20);&lt;br /&gt;
    cell.setPaddingRight(50);&lt;br /&gt;
    cell.setPaddingTop(0);&lt;br /&gt;
    cell.setPaddingBottom(5);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set padding for table cell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Phrase;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    table.setWidthPercentage(100);&lt;br /&gt;
    PdfPCell cell = new PdfPCell(new Paragraph(&lt;br /&gt;
        &amp;quot;Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.&amp;quot;));&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;Quick brown fox jumps over the lazy dog.&amp;quot;));&lt;br /&gt;
    table.addCell(&amp;quot;padding 10&amp;quot;);&lt;br /&gt;
    cell.setPadding(10);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;padding 0&amp;quot;);&lt;br /&gt;
    cell.setPadding(0);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set table cell fixed height ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.PageSize;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document(PageSize.A5.rotate());&lt;br /&gt;
      PdfWriter.getInstance(&lt;br /&gt;
          document,&lt;br /&gt;
          new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
      document.open();&lt;br /&gt;
      PdfPTable table = new PdfPTable(2);&lt;br /&gt;
      table.setExtendLastRow(true);&lt;br /&gt;
      PdfPCell cell;&lt;br /&gt;
      cell = new PdfPCell(new Paragraph(&amp;quot;blah&amp;quot;));&lt;br /&gt;
      table.addCell(&amp;quot;wrap&amp;quot;);&lt;br /&gt;
      cell.setNoWrap(false);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;no wrap&amp;quot;);&lt;br /&gt;
      cell.setNoWrap(true);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;fixed height (not sufficient)&amp;quot;);&lt;br /&gt;
      cell.setFixedHeight(36f);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set table cell minimun height ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.PageSize;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document(PageSize.A5.rotate());&lt;br /&gt;
      PdfWriter.getInstance(&lt;br /&gt;
          document,&lt;br /&gt;
          new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
      document.open();&lt;br /&gt;
      PdfPTable table = new PdfPTable(2);&lt;br /&gt;
      table.setExtendLastRow(true);&lt;br /&gt;
      PdfPCell cell;&lt;br /&gt;
      cell = new PdfPCell(new Paragraph(&amp;quot;blah&amp;quot;));&lt;br /&gt;
      table.addCell(&amp;quot;wrap&amp;quot;);&lt;br /&gt;
      cell.setNoWrap(false);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;no wrap&amp;quot;);&lt;br /&gt;
      cell.setNoWrap(true);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;fixed height (not sufficient)&amp;quot;);&lt;br /&gt;
      cell.setMinimumHeight(36f);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set table cell no wrap ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.PageSize;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document(PageSize.A5.rotate());&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    table.setExtendLastRow(true);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;blah&amp;quot;));&lt;br /&gt;
    table.addCell(&amp;quot;wrap&amp;quot;);&lt;br /&gt;
    cell.setNoWrap(false);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    table.addCell(&amp;quot;no wrap&amp;quot;);&lt;br /&gt;
    cell.setNoWrap(true);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set table column width ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
      PdfWriter.getInstance(&lt;br /&gt;
          document,&lt;br /&gt;
          new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
      document.open();&lt;br /&gt;
      float[] widths = { 1, 4 };&lt;br /&gt;
      PdfPTable table = new PdfPTable(widths);&lt;br /&gt;
      table.setWidthPercentage(30);&lt;br /&gt;
      PdfPCell cell = new PdfPCell(new Paragraph(&amp;quot;fox&amp;quot;));&lt;br /&gt;
      cell.setHorizontalAlignment(Element.ALIGN_CENTER);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;asdf&amp;quot;);&lt;br /&gt;
      document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Set width percentage ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
      PdfWriter.getInstance(&lt;br /&gt;
          document,&lt;br /&gt;
          new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
      document.open();&lt;br /&gt;
      float[] widths = { 1, 4 };&lt;br /&gt;
      PdfPTable table = new PdfPTable(widths);&lt;br /&gt;
      table.setWidthPercentage(30);&lt;br /&gt;
      PdfPCell cell = new PdfPCell(new Paragraph(&amp;quot;fox&amp;quot;));&lt;br /&gt;
      cell.setPadding(4);&lt;br /&gt;
      table.addCell(cell);&lt;br /&gt;
      table.addCell(&amp;quot;asdf&amp;quot;);&lt;br /&gt;
      document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Table alignment: bottom, middle and top ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.DocumentException;&lt;br /&gt;
import com.lowagie.text.Element;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    table.addCell(&amp;quot;blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n&amp;quot;);&lt;br /&gt;
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);&lt;br /&gt;
    table.addCell(&amp;quot;bottom&amp;quot;);&lt;br /&gt;
    table.addCell(&amp;quot;blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n&amp;quot;);&lt;br /&gt;
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);&lt;br /&gt;
    table.addCell(&amp;quot;middle&amp;quot;);&lt;br /&gt;
    table.addCell(&amp;quot;blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n&amp;quot;);&lt;br /&gt;
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);&lt;br /&gt;
    table.addCell(&amp;quot;top&amp;quot;);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Table cell ascender and descender ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Phrase;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document();&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(2);&lt;br /&gt;
    table.setWidthPercentage(100);&lt;br /&gt;
    PdfPCell cell = new PdfPCell(new Paragraph(&lt;br /&gt;
        &amp;quot;Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog.&amp;quot;));&lt;br /&gt;
    Phrase p = new Phrase(&amp;quot;Quick brown fox jumps over the lazy dog&amp;quot;);&lt;br /&gt;
    table.getDefaultCell().setPadding(2);&lt;br /&gt;
    table.getDefaultCell().setUseAscender(false);&lt;br /&gt;
    table.getDefaultCell().setUseDescender(false);&lt;br /&gt;
    table.addCell(&amp;quot;padding 2; no ascender, no descender&amp;quot;);&lt;br /&gt;
    table.addCell(p);&lt;br /&gt;
    table.getDefaultCell().setUseAscender(true);&lt;br /&gt;
    table.getDefaultCell().setUseDescender(false);&lt;br /&gt;
    table.addCell(&amp;quot;padding 2; ascender, no descender&amp;quot;);&lt;br /&gt;
    table.addCell(p);&lt;br /&gt;
    table.getDefaultCell().setUseAscender(false);&lt;br /&gt;
    table.getDefaultCell().setUseDescender(true);&lt;br /&gt;
    table.addCell(&amp;quot;padding 2; descender, no ascender&amp;quot;);&lt;br /&gt;
    table.addCell(p);&lt;br /&gt;
    table.getDefaultCell().setUseAscender(true);&lt;br /&gt;
    table.getDefaultCell().setUseDescender(true);&lt;br /&gt;
    table.addCell(&amp;quot;padding 2; ascender and descender&amp;quot;);&lt;br /&gt;
    cell.setPadding(2);&lt;br /&gt;
    cell.setUseAscender(true);&lt;br /&gt;
    cell.setUseDescender(true);&lt;br /&gt;
    table.addCell(p);&lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Table cell without border ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import com.lowagie.text.Document;&lt;br /&gt;
import com.lowagie.text.PageSize;&lt;br /&gt;
import com.lowagie.text.Paragraph;&lt;br /&gt;
import com.lowagie.text.Rectangle;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPCell;&lt;br /&gt;
import com.lowagie.text.pdf.PdfPTable;&lt;br /&gt;
import com.lowagie.text.pdf.PdfWriter;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    Document document = new Document(PageSize.A4.rotate());&lt;br /&gt;
    PdfWriter.getInstance(document, new FileOutputStream(&amp;quot;2.pdf&amp;quot;));&lt;br /&gt;
    document.open();&lt;br /&gt;
    PdfPTable table = new PdfPTable(4);&lt;br /&gt;
    table.setWidthPercentage(100);&lt;br /&gt;
    PdfPCell cell;&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;t&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;d&amp;quot;));&lt;br /&gt;
    cell.setBorder(Rectangle.NO_BORDER);&lt;br /&gt;
    cell.setBackgroundColor(Color.red);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;r&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;b&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;G:&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;0.25&amp;quot;));&lt;br /&gt;
    cell.setBorder(Rectangle.NO_BORDER);&lt;br /&gt;
    cell.setGrayFill(0.25f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;0.5&amp;quot;));&lt;br /&gt;
    cell.setBorder(Rectangle.NO_BORDER);&lt;br /&gt;
    cell.setGrayFill(0.5f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;0.75&amp;quot;));&lt;br /&gt;
    cell.setBorder(Rectangle.NO_BORDER);&lt;br /&gt;
    cell.setGrayFill(0.75f);&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;:&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;a&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;b&amp;quot;));&lt;br /&gt;
    table.addCell(cell);&lt;br /&gt;
    cell = new PdfPCell(new Paragraph(&amp;quot;o&amp;quot;));&lt;br /&gt;
    cell.setBorderWidth(6f);&lt;br /&gt;
    cell.setBorderColor(Color.orange);&lt;br /&gt;
    table.addCell(cell);    &lt;br /&gt;
    document.add(table);&lt;br /&gt;
    document.close();&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>