When I use the pdfCanvas object I have the MoveText
method where I can set the x and y coordinate but I don't see that in the Paragraph object? Second thing is why do I need the rectangle object I am not adding any Rectangle to the pdf just Text. Where I want the text to take the full width of the page. Can I get the size of the font and text and then calculate the centeredWidth and centeredHeight if I only have MoveText method in pdfCanvas?
for (int i = 1; i <= numberOfPages; i++)
{
PdfPage pdfPage = pdfDocument.GetPage(i);
iText.Kernel.Geom.Rectangle pageSizeWithRotation = pdfPage.GetPageSizeWithRotation();
float n2 = 15F;
float n3 = pageSizeWithRotation.GetHeight() - 10F;
float frontSize = 6.25f;
PdfCanvas pdfCanvas = new PdfCanvas(pdfPage);
iText.Kernel.Geom.Rectangle rectangle = new iText.Kernel.Geom.Rectangle(100, 100, 100, 100);
Canvas canvas = new Canvas(pdfCanvas, rectangle);
PdfFont font = PdfFontFactory.CreateFont("C:\\Windows\\Fonts\\ARIALN.TTF");
Paragraph p = new Paragraph()
.Add(disclaimerText)
.SetFont(font)
.SetFontSize(frontSize)
.SetTextAlignment(TextAlignment.CENTER);
canvas.Add(p);
canvas.Close();
//pdfCanvas.BeginText()
// .SetFillColorRgb(0, 0, 0)
// .SetFontAndSize(PdfFontFactory.CreateFont("C:\\Windows\\Fonts\\ARIALN.TTF"), frontSize)
// .MoveText(n2, n3)
// .ShowText(disclaimerText)
// .EndText();
}