title: I am editing a pdf want to add table at given page in pdf
body: <p>Below is a code I've written to add table to 8 page in PDF using itext7 .</p>
  
  <p>Unfortunately, it is adding only to first page instead of 8th page.</p>
  
  <pre><code>PdfDocument pdfDoc = new PdfDocument(new PdfReader(src), new PdfWriter(dest));
  Table table = new Table(new float[]{1, 15});
  table.setWidthPercent(80);
  table.addHeaderCell("#");
  table.addHeaderCell("description");
  PageSize ps = pdfDoc.getDefaultPageSize();
  PdfPage p =pdfDoc.getPage(8);
  Document doc = new Document(p.getDocument());
  table.setFixedPosition(doc.getLeftMargin(), doc.getBottomMargin(), ps.getWidth() - doc.getLeftMargin() - doc.getRightMargin());
  IRenderer tableRenderer = table.createRendererSubTree().setParent(doc.getRenderer());
  LayoutResult tableLayoutResult = tableRenderer.layout(new LayoutContext(new LayoutArea(0, new Rectangle(ps.getWidth(), 1000))));
  float totalHeight = tableLayoutResult.getOccupiedArea().getBBox().getHeight();
  doc.add(table);
  doc.close();
  </code></pre>
  
  <p>I am unable to identify where the problem is.</p>
  
  <p>What am I doing wrong and how can I effectively add table to particular pages?</p>