title: iTextSharp Nest Tables, inner table not 100% width?
body: <p>I'm using asp.net 4.0 with iTextSharp in it's own class library. From properties,  runtime version v2.0.50727, version 5.3.0.0.</p>
  
  <p>When I nest two tables, the inner table has an automatical margin or padding I can't control. How do I get both tables to be 100%?</p>
  
  <p>//edited</p>
  
  <pre><code>public PdfPTable GetHeaderInnerTable(Rectangle pageSize)
  {
  // create 2 table cell
  // left cell for Report Header text
  // right cell for microsoft internal only image
  int columnCount = 2;
  
  
  PdfPTable table = new PdfPTable(columnCount);
  table.TotalWidth = 792;
  //table.WidthPercentage = 100; // 80 is default - THIS IS THE ANSWER TO MAKE INNER TABLE 100%
  float[] widthColumns = new float[] { 652, 140 }; //left edge of second column is where image should be
  table.SetTotalWidth(widthColumns);
  
  // Left Cell
  PdfPCell leftCell = new PdfPCell();
  leftCell.Border = 0;
  
  Font font = fontHeaderSegoeUIRegular;
  font.Color = BaseColor.WHITE;
  Phrase phrase = new Phrase(0, this.PdfModel.CompanyName + Data.Strings_DataResource.PdfTitlePostpend, font);
  leftCell.AddElement(phrase);
  leftCell.PaddingLeft = 40; // where to start the report name text from the left
  leftCell.PaddingTop = 30; // where to start the report name text from the bottom
  
  // Right Cell
  PdfPCell rightCell = new PdfPCell();
  rightCell.Border = 0;
  Image image = Image.GetInstance(this.PdfModel.ImageAssets.Get("HeaderBarRightMicrosoftInternalImageLocation"));
  
  rightCell.FixedHeight = 90; // total height of red bar
  rightCell.AddElement(image);
  rightCell.Padding = 0;
  rightCell.PaddingBottom = 10; // push image up off the red bar
  rightCell.BorderWidthRight = 0;
  rightCell.PaddingTop = 20; // push image down off the red bar
  
  //// add cells to table
  table.AddCell(leftCell);
  table.AddCell(rightCell);
  
  return table;
  }
  
  public PdfPTable GetHeader(Rectangle pageSize)
  {
  int columnCount = 1;
  
  PdfPTable table = new PdfPTable(columnCount);
  table.DefaultCell.VerticalAlignment = Element.ALIGN_TOP;
  table.TotalWidth = pageSize.Width; //792  
  
  
  PdfPCell headerLeftCell = new PdfPCell();
  headerLeftCell.Colspan = 1;
  float getleft = headerLeftCell.GetLeft(0);
  float leading = headerLeftCell.Leading;
  
  headerLeftCell.Padding = 0;
  headerLeftCell.PaddingBottom = 0;
  headerLeftCell.BorderWidthRight = 0;
  headerLeftCell.PaddingTop = 0; // how far donw to print the phrase
  headerLeftCell.PaddingLeft = 0; // how far in to print the phrase
  headerLeftCell.FixedHeight = this.PixelsToPoints(90); // cell controls height of table
  headerLeftCell.Border = 0;
  headerLeftCell.Indent = 0;
  
  Image backgroundHeaderImage = iTextSharp.text.Image.GetInstance(this.PdfModel.ImageAssets.Get("HeaderBarImageLocation"));  
  
  // assign background Image to cell - 60 instead of 54 because it was gett squashed - probably the padding somehow            
  headerLeftCell.CellEvent = new BackgroundImageCellEvent(backgroundHeaderImage, 60, 792);
  
  headerLeftCell.AddElement(this.GetHeaderInnerTable(pageSize));
  
  table.AddCell(headerLeftCell);
  
  return table;
  }
  </code></pre>