I am trying to display a cell in iTextSharp Version in a second page but it does not display the cells for some reason here is the code
float dpi = 100f;
float widthInches = (3900f * 1.1f) / dpi;
float heightInches = (2775f * 1.1f) / dpi;
// Increase the size of the Rectangle object by 10%
float width = widthInches * 1.1f * 72f;
float height = heightInches * 1.1f * 72f;
var pageSize = new iTextSharp.text.Rectangle(width, height);
var rect = new iTextSharp.text.Rectangle(width, height);
iTextSharp.text.Document document = new iTextSharp.text.Document(rect, 10f, 10f, 10f, 0f);
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, new System.IO.FileStream(dest, System.IO.FileMode.Create));
document.Open();
...
document.NewPage();
iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(model.CaraB["1"]);
image.SetAbsolutePosition(0, 0);
image.ScaleToFit(3400, 2400);
document.Add(image1);
PdfPTable table = new PdfPTable(2);
// Create header cells
PdfPCell header1 = new PdfPCell(new iTextSharp.text.Phrase(new iTextSharp.text.Chunk("Logros", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD))));
PdfPCell header2 = new PdfPCell(new iTextSharp.text.Phrase(new iTextSharp.text.Chunk("Horas", iTextSharp.text.FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD))));
// Add header cells to table
table.AddCell(header1);
table.AddCell(header2);
// Create data cells
PdfPCell cell1 = new PdfPCell(new iTextSharp.text.Phrase(new iTextSharp.text.Chunk("Unlogro", iTextSharp.text.FontFactory.GetFont("Arial", 10))));
PdfPCell cell2 = new PdfPCell(new iTextSharp.text.Phrase(new iTextSharp.text.Chunk("12", iTextSharp.text.FontFactory.GetFont("Arial", 10))));
document.close();
the output is the following [![PDF output][1]][1] [1]: https://i.sstatic.net/ni8WA.png
here is how I solved it
document.NewPage();
iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(model.CaraB["1"]);
image1.SetAbsolutePosition(0, 0);
image1.ScaleToFit(3400, 2400);
document.Add(image1);
// create a new PdfPTable object with two columns
PdfPTable table = new PdfPTable(2);
iTextSharp.text.Paragraph paragraph = new iTextSharp.text.Paragraph();
paragraph.SpacingAfter = 15f;
PdfPCell cell = new PdfPCell( );
cell.Colspan = 2;
cell.HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER;
table.AddCell(cell);
table.AddCell(new iTextSharp.text.Paragraph("HEADER1", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 74, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK)));
table.AddCell(new iTextSharp.text.Paragraph("HEADER2", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, 74, iTextSharp.text.Font.BOLD, iTextSharp.text.BaseColor.BLACK)));