iText PdfpTable PdfPCell row alignment and spacing
<p>I inherited the maintenance of a Java application to create invoices. It uses the iText PDF library. My questions concern the formatting happening in the creation of the header and footer in the <code>onEndPageEvent()</code>.</p>

<p>The document has the following borders. </p>

<pre><code>Document document = new Document(PageSize.LETTER, 18, 72, 205, 170);
</code></pre>

<p>The header table has the following characteristics:</p>

<pre><code>PdfPTable tHead = new PdfPTable(5);
int tHead_tHeaderwidths[] = { 4, 5, 50, 15, 26 };
tHead.setWidths(tHead_tHeaderwidths);
</code></pre>

<p>A GIF image creates a borderline as the last row in the header table as follows:</p>

<pre><code>c = new PdfPCell(invoice_header1);
c.setColspan(5);
c.setBorder(0);
c.setPaddingTop(10);            
c.setPaddingLeft(10);                
c.setHorizontalAlignment(Element.ALIGN_CENTER);            
tHead.addCell(c);
</code></pre>

<p>The footer table has the following characteristics:</p>

<pre><code>PdfPTable tFoot = new PdfPTable(3);
int total_table_headerwidths[] = { 75, 5, 20 }; // percentage
tFoot.setWidths(total_table_headerwidths);
</code></pre>

<p>A GIF image creates a borderline as the first row in the footer table as well.</p>

<pre><code>c = new PdfPCell(invoice_header2);
c.setColspan(3);
c.setBorder(0);                       
c.setHorizontalAlignment(Element.ALIGN_CENTER);            
tFoot.addCell(c);
</code></pre>

<p><em>Why do these images not align on the right-hand side in the document?</em>
They should align to the right hand border.</p>

<p><em>Why does the text in the first rows of the header table and the rows at the bottom of the footer table have row spacing, spacing between lines, different than other text added to the document?</em>
The text has the same font as other text and no other space formatting applied.</p>

<p>Here is a screenshot of the document
<img src="https://i.stack.imgur.com/aS8RV.png" alt="Screenshot"></p>