I recently started using iTextSharp to create PDF reports from data. It works very well.
In one specific report, I need the section to always appear at the bottom of the page. I use PdfContentByte to create a dashed line 200f from below:
cb.MoveTo(0f, 200f); cb.SetLineDash(8, 4, 0); cb.LineTo(doc.PageSize.Width, 200f); cb.Stroke();
Now I would like to add content below this line. However (as expected), the PdfContentByte methods do not change the vertical position of the PdfWriter. For example, new paragraphs appear on the page earlier.
// appears wherever my last content was, NOT below the dashed line doc.Add(new Paragraph("test", _myFont));
Is there a way to instruct the pdfwriter that I would like to advance the vertical position below the dashed line and continue to paste the content there? There is a GetVerticalPosition () method - it would be nice if there was a corresponding Setter :-).
// Gives me the vertical position, but I can't change it var pos = writer.GetVerticalPosition(false);
So, is there a way to set the writer position manually? Thanks!
source share