我已经创建了一个带有图形的 pdf 文件,现在正试图在这些图形下添加一个表格。我的问题是表格在图形上方,如何指定我希望将表格放置在 pdf 文档上的位置/位置?
这是我的代码
docl.Open();
docl.Add(new Paragraph("My first PDF file"));
PdfContentByte cb = writer.DirectContent;
//employee
// position y,position x,length,height, unknown
cb.RoundRectangle( 20f, 745f, 200f, 35f, 10f);
//title
cb.RoundRectangle(235f, 745f, 35f, 35f, 10f);
//identity number
cb.RoundRectangle(280f, 745f, 105f, 35f, 10f);
//date of birth
cb.RoundRectangle(390f, 745f, 105f, 35f, 10f);
//employee number
cb.RoundRectangle(500f, 745f, 105f, 35f, 10f);
//address
cb.RoundRectangle(20f, 660f, 200f, 80f, 10f);
//pay method
cb.RoundRectangle(235f, 700f, 35f, 35f, 10f);
//brantch code
cb.RoundRectangle(235f, 660f, 35f, 35f, 10f);
//bank
cb.RoundRectangle(280f, 700f, 215f, 35f, 10f);
//account type
cb.RoundRectangle(500f, 700f, 105f, 35f, 10f);
//account number
cb.RoundRectangle(280f, 660f, 160f, 35f, 10f);
//pay point
cb.RoundRectangle(445f, 660f, 35f, 35f, 10f);
//date of payment
cb.RoundRectangle(506f, 660f, 90f, 35f, 10f);
//marital status
cb.RoundRectangle(20f, 600f, 35f, 35f, 10f);
//gender
cb.RoundRectangle(60f, 600f, 35f, 35f, 10f);
//date of appointment
cb.RoundRectangle(100f, 600f, 70f, 35f, 10f);
//Tax number
cb.RoundRectangle(175f, 600f, 70f, 35f, 10f);
cb.Stroke();
PdfPTable table = new PdfPTable(2);
table.HorizontalAlignment = 0;
table.SetTotalWidth(new float[] { 800, 200 });
PdfPCell cell = new PdfPCell(new Phrase("EARNINGS"));
cell.Colspan = 2;
cell.HorizontalAlignment = 1;
table.AddCell(cell);
table.AddCell("Description");
table.AddCell("Amount");
我用这一行来指定图形在文档上的位置: // position y, position x,length,height, unknown cb.RoundRectangle(20f, 745f, 200f, 35f, 10f);
我想将表格放在图形下方。