I wanted to know if there is a way to know how high the writing is in a pdf generated by means of class ItextSharp.text.Document
;
For example, when generating a pdf document with ItextSharp, I know that I only have to execute the document.PageSize
instruction and I get a ItextSharp.text.Rectangle
, from which I can take measurements of the page. But if the page had a height of 1000, but if what was written in that document would reach half, the text would reach 500. This number 500 is the one I am interested in finding out.
Here I add what I do.
Rectangle rec= new Rectangle(1000, 215);
Document document = new Document(rec, 10,10,10,10);
Font fuente = FontFactory.GetFont("Arial", 12, Font.BOLD);
Lineas = obtenerLineas() //obtengo las líneas para agregar al documento
document.Open();
foreach(linea in Lineas)
{
Paragraph textLine = new Paragraph(linea.texto, fuente);
document.add(textLine);
}
document.Close();
Note: Rectangle, Document, Font, Pagraph classes are from the ITextSharp library.